onHandler($request, $passable); } catch (\Throwable $throwable) { return Json::to(0, $throwable); } finally { fire(Event::EVENT_AFTER_REQUEST); } }; }); } /** * @return Closure */ private static function core(): Closure { return function ($stack, $pipe) { return function ($passable) use ($stack, $pipe) { if ($pipe instanceof Middleware) { return $pipe->onHandler($passable, $stack); } else { return call_user_func($pipe, $passable, $stack); } }; }; } }