onHandler($request, $passable); }; }); } /** * @return Closure */ private static function core(): Closure { return function ($stack, $pipe) { return static::passable($stack, $pipe); }; } /** * @param $stack * @param $pipe * @return Closure */ public static function passable($stack, $pipe): Closure { return function ($passable) use ($stack, $pipe) { if ($pipe instanceof Middleware) { return $pipe->onHandler($passable, $stack); } return call_user_func($pipe, $passable, $stack); }; } }