/** * Finds a route that matches the request * @param \snb\http\Request $request * @return Route */ public function findMatchingRoute(Request $request) { // go though all the routes in order and return the first matching one $path = urldecode($request->getPath()); foreach ($this->routes as $route) { if ($route->isMatch($path, $request)) { return $route; } } return null; }