/** * Gets whether or not the token should even be checked * * @param Request $request The current request * @return bool True if the token should be checked, otherwise false */ private function tokenShouldNotBeChecked(Request $request) { return in_array($request->getMethod(), [Request::METHOD_GET, Request::METHOD_HEAD, Request::METHOD_OPTIONS]); }
/** * Routes a request * * @param Request $request The request to route * @return Response The response from the controller * @throws RouteException Thrown if the controller or method could not be called * @throws HttpException Thrown if there was no matching route */ public function route(Request $request) { $method = $request->getMethod(); /** @var ParsedRoute $route */ foreach ($this->routeCollection->get($method) as $route) { $compiledRoute = $this->compiler->compile($route, $request); if ($compiledRoute->isMatch()) { $this->matchedRoute = $compiledRoute; return $this->dispatcher->dispatch($this->matchedRoute, $request, $this->matchedController); } } // If we've gotten here, we've got a missing route throw new HttpException(404); }