Autarky\Routing\Route::setRouter PHP Method

setRouter() public static method

Somewhat of a hack to make var_export caching work.
public static setRouter ( Autarky\Routing\RouterInterface $router )
$router Autarky\Routing\RouterInterface
    public static function setRouter(RouterInterface $router)
    {
        static::$router = $router;
    }

Usage Example

Example #1
0
 /**
  * @param RouteParser $routeParser
  * @param InvokerInterface $invoker
  * @param EventDispatcherInterface|null $eventDispatcher
  * @param string|null $cachePath
  */
 public function __construct(RouteParser $routeParser, InvokerInterface $invoker, EventDispatcherInterface $eventDispatcher = null, $cachePath = null)
 {
     $this->routes = new \SplObjectStorage();
     $this->invoker = $invoker;
     $this->eventDispatcher = $eventDispatcher;
     if ($cachePath) {
         $this->cachePath = $cachePath;
         if (file_exists($cachePath)) {
             Route::setRouter($this);
             $this->dispatchData = (require $cachePath);
             return;
         }
     }
     $this->routeCollector = new RouteCollector($routeParser, new DataGenerator());
 }