This commit is contained in:
2020-09-04 18:49:36 +08:00
parent b2bc8e3726
commit 04ed73b902
2 changed files with 7 additions and 36 deletions
+7 -10
View File
@@ -49,16 +49,13 @@ class Middleware
*/
public function getGenerate($node)
{
foreach ($node->handler as $key => $value) {
$last = function ($passable) use ($node) {
return Dispatch::create($node->handler, $passable)->dispatch();
};
$middleWares = $this->annotation($node);
$data = array_reduce(array_reverse($middleWares), $this->core(), $last);
$this->middleWares = [];
$node->callback[$key] = $data;
}
return $node;
$last = function ($passable) use ($node) {
return Dispatch::create($node->handler, $passable)->dispatch();
};
$middleWares = $this->annotation($node);
$data = array_reduce(array_reverse($middleWares), $this->core(), $last);
$this->middleWares = [];
return $node->callback = $data;
}