Autarky\Routing\Router::addCachedRoute PHP Method

addCachedRoute() public method

Add a cached route.
public addCachedRoute ( Route $route )
$route Route
    public function addCachedRoute(Route $route)
    {
        $this->routes->attach($route);
        if ($name = $route->getName()) {
            $this->addNamedRoute($name, $route);
        }
    }

Usage Example

Example #1
0
 /**
  * Re-build a Route object from data that has been var_export-ed.
  *
  * @param  array $data
  *
  * @return static
  */
 public static function __set_state($data)
 {
     $route = new static($data['methods'], $data['pattern'], $data['controller'], $data['name'], $data['options']);
     if (static::$router !== null) {
         static::$router->addCachedRoute($route);
     }
     return $route;
 }