Skip to content

Commit 1b9ac8d

Browse files
author
Greg Bowler
committed
Call before, go, after in the correct order across multiple logics.
1 parent 06cdd43 commit 1b9ac8d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Dispatcher/Dispatcher.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ public function process() {
182182
if(method_exists($logicObj, "before")) {
183183
$logicObj->before();
184184
}
185-
$logicObj->go();
185+
}
186+
foreach ($logicList as $logicObj) {
187+
if(method_exists($logicObj, "go")) {
188+
$logicObj->go();
189+
}
186190

187191
$data = array_merge($_GET, $_POST);
188192
if(!empty($data["do"])) {
@@ -198,11 +202,14 @@ public function process() {
198202
$logicObj->$doMethodCamel($data);
199203
}
200204
}
205+
}
201206

207+
foreach ($logicList as $logicObj) {
202208
if(method_exists($logicObj, "after")) {
203209
$logicObj->after();
204210
}
205211
}
212+
206213
foreach (array_reverse($logicList) as $logicObj) {
207214
if(!method_exists($logicObj, "endGo")) {
208215
continue;

0 commit comments

Comments
 (0)