This commit is contained in:
2020-12-16 16:41:47 +08:00
parent 0274ddc60b
commit 0b9862755f
2 changed files with 4 additions and 22 deletions
+4 -18
View File
@@ -55,24 +55,10 @@ class Middleware
*/ */
public function getGenerate(Node $node): mixed public function getGenerate(Node $node): mixed
{ {
try { $this->set_attributes($node);
// if (is_array($node->handler) && is_object($node->handler[0])) { return $node->callback = Reduce::reduce(function () use ($node) {
// } return Dispatch::create($node->handler, func_get_args())->dispatch();
$this->set_attributes($node); }, $this->annotation($node));
return $node->callback = Reduce::reduce(function () use ($node) {
if (!request()->isOption) {
var_dump($node);
}
return Dispatch::create($node->handler, func_get_args())->dispatch();
}, $this->annotation($node));
} catch (\Throwable $exception) {
return $node->callback = function () use ($exception) {
return JSON::to(500, $exception->getMessage(), [
'file' => $exception->getFile(),
'line' => $exception->getLine()
]);
};
}
} }
-4
View File
@@ -228,7 +228,6 @@ class Node extends Application
$handler = [$handler]; $handler = [$handler];
} }
foreach ($handler as $closure) { foreach ($handler as $closure) {
var_dump($closure);
$this->_interceptors[] = $closure; $this->_interceptors[] = $closure;
} }
$this->restructure(); $this->restructure();
@@ -245,7 +244,6 @@ class Node extends Application
$handler = [$handler]; $handler = [$handler];
} }
foreach ($handler as $closure) { foreach ($handler as $closure) {
var_dump($closure);
$this->_after[] = $closure; $this->_after[] = $closure;
} }
$this->restructure(); $this->restructure();
@@ -262,7 +260,6 @@ class Node extends Application
$handler = [$handler]; $handler = [$handler];
} }
foreach ($handler as $closure) { foreach ($handler as $closure) {
var_dump($closure);
$this->_limits[] = $closure; $this->_limits[] = $closure;
} }
$this->restructure(); $this->restructure();
@@ -410,7 +407,6 @@ class Node extends Application
$class = [$class]; $class = [$class];
} }
foreach ($class as $closure) { foreach ($class as $closure) {
var_dump($closure);
$this->middleware[] = $closure; $this->middleware[] = $closure;
} }
$this->restructure(); $this->restructure();