Inheritance: extends Illuminate\Routing\Route
 /**
  * Add the given route to the arrays of routes.
  *
  * @param \Themosis\Route\Route $route
  * @return void
  */
 protected function addToCollection(Route $route)
 {
     foreach ($route->methods() as $method) {
         static::$routes[$method][$route->condition()][] = $route;
         static::$allRoutes[$method . $route->condition()][] = $route;
     }
 }
Example #2
0
 public function matches(Route $route, Request $request)
 {
     // Check if a template is associated and compare it to current route condition.
     if ($route->condition() && call_user_func_array($route->condition(), [$route->conditionalParameters()])) {
         return true;
     }
     return false;
 }
 /**
  * Add the route to any look-up tables if necessary.
  *
  * @param \Themosis\Route\Route $route
  * @return void
  */
 protected function addLookups($route)
 {
     // If the route has a name, we will add it to the name look-up table so that we
     // will quickly be able to find any route associate with a name and not have
     // to iterate through every route every time we need to perform a look-up.
     $action = $route->getAction();
     if (isset($action['as'])) {
         static::$nameList[$action['as']] = $route;
     }
     // When the route is routing to a controller we will also store the action that
     // is used by the route. This will let us reverse route to controllers while
     // processing a request and easily generate URLs to the given controllers.
     if (isset($action['controller'])) {
         $this->addToActionList($action, $route);
     }
 }
Example #4
0
 /**
  * Add the given route to the arrays of routes.
  *
  * @param \Themosis\Route\Route $route
  */
 protected function addToCollections($route)
 {
     $domainAndUri = $route->domain() . $route->getUri();
     if ($route->condition() && $route->conditionalParameters()) {
         $domainAndUri .= serialize($route->conditionalParameters());
     }
     foreach ($route->methods() as $method) {
         $this->routes[$method][$domainAndUri] = $route;
     }
     $this->allRoutes[$method . $domainAndUri] = $route;
 }
 /**
  * Call the given controller instance method.
  *
  * @param  \Themosis\Route\Controller $instance
  * @param  \Themosis\Route\Route $route
  * @param  string $method
  * @return mixed
  */
 protected function call($instance, $route, $method)
 {
     $parameters = $route->parametersWithoutNulls();
     return $instance->callAction($method, $parameters);
 }