Autarky\Routing\Router::__construct PHP Method

__construct() public method

public __construct ( FastRoute\RouteParser $routeParser, Autarky\Routing\InvokerInterface $invoker, Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher = null, string | null $cachePath = null )
$routeParser FastRoute\RouteParser
$invoker Autarky\Routing\InvokerInterface
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$cachePath string | null
    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());
    }