public function dispatch($request = null)
{
list($method, $pathInfo) = $this->parseIncomingRequest($request);
try {
return $this->sendThroughPipeline($this->middleware, function () use($method, $pathInfo) {
if (isset($this->routes[$method . $pathInfo])) {
return $this->handleFoundRoute([true, $this->routes[$method . $pathInfo]['action'], []]);
}
return $this->handleDispatcherResponse($this->createDispatcher()->dispatch($method, $pathInfo));
});
} catch (Exception $e) {
return $this->sendExceptionToHandler($e);
} catch (Throwable $e) {
return $this->sendExceptionToHandler($e);
}
}