/** * Find a route * * @return Route */ public function findRoute(Request $request) { $path = $request->path(); $method = $request->method(); for ($i = 0; $i < count($this->routes); ++$i) { if ($this->routes[$i]->testPath($path, $method)) { return $this->routes[$i]; } } return null; }
/** * @param Request $request * @return Route|null */ public function findRoute(Request $request) { $method = $request->method(); $rawPath = $request->path(); $preparedPath = $this->prepareUriPath($rawPath); for ($i = 0; $i < count($this->routes); ++$i) { if ($this->testRoute($this->routes[$i], $preparedPath, $rawPath, $method)) { return $this->routes[$i]; } } return null; }