Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * @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;
 }