/** * Add the given route to the arrays of routes. * * @param \Nova\Routing\Route $route * @return void */ protected function addToCollections($route) { $domainAndUri = $route->domain() . $route->getUri(); foreach ($route->methods() as $method) { $this->routes[$method][$domainAndUri] = $route; } $this->allRoutes[$method . $domainAndUri] = $route; }
/** * Get all of the pattern filters matching the route. * * @param \Nova\Routing\Route $route * @return array */ protected function getPatternFilters($route) { $patterns = array(); foreach ($route->methods() as $method) { // For each method supported by the route we will need to gather up the patterned // filters for that method. We will then merge these in with the other filters // we have already gathered up then return them back out to these consumers. $inner = $this->getMethodPatterns($route->uri(), $method); $patterns = array_merge($patterns, array_keys($inner)); } return $patterns; }
/** * Validate a given rule against a route and request. * * @param \Nova\Routing\Route $route * @param \Nova\Http\Request $request * @return bool */ public function matches(Route $route, Request $request) { return in_array($request->getMethod(), $route->methods()); }