/** * Initializes the Route by reading the default config, registering routes and creating * necessary object instances. * Note: this method is called automatically when you do Router::setConfig(). */ public function initialize() { // check if we have already initialized the router if ($this->initializedFlag) { return; } // do initialization $this->loader = new ConfigLoader(self::getConfig()->get('Routes', new ConfigObject([]))); self::$routeCollection = $this->loader->getRouteCollection(); $this->urlMatcher = new UrlMatcher(); $this->urlGenerator = new UrlGenerator(); $this->setCache(self::getConfig()->get('Cache', false)); $this->initializedFlag = true; //print_r(Router::getConfig()->toArray()); }