This commit is contained in:
2021-04-20 13:48:33 +08:00
parent 23995df1af
commit f647b5bd39
2 changed files with 21 additions and 7 deletions
+3
View File
@@ -532,6 +532,9 @@ class Node extends HttpService
if ($this->handler instanceof Closure) { if ($this->handler instanceof Closure) {
return call_user_func($this->handler, ...$dispatchParams); return call_user_func($this->handler, ...$dispatchParams);
} }
var_dump($dispatchParams);
$validator = $this->getValidator(); $validator = $this->getValidator();
if (!($validator instanceof Validator)) { if (!($validator instanceof Validator)) {
return call_user_func($this->callback, ...$dispatchParams); return call_user_func($this->callback, ...$dispatchParams);
+18 -7
View File
@@ -52,13 +52,24 @@ class Reduce
private static function core(): Closure private static function core(): Closure
{ {
return function ($stack, $pipe) { return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) { return static::passable($stack, $pipe);
if ($pipe instanceof Middleware) { };
return $pipe->onHandler($passable, $stack); }
} else {
return call_user_func($pipe, $passable, $stack);
} /**
}; * @param $stack
* @param $pipe
* @return Closure
*/
public static function passable($stack, $pipe): Closure
{
return function ($passable) use ($stack, $pipe) {
if (!($pipe instanceof Middleware)) {
return call_user_func($pipe, $passable, $stack);
} else {
return $pipe->onHandler($passable, $stack);
}
}; };
} }