/** * {@inheritDoc} */ public function build() { $config = $this->buildFromFile(); $routeCfgAsArray = $this->getRouteConfigurationFromConfig($config->load()); $routeConfiguration = RouteCollectionBuilder::build($routeCfgAsArray); $urlGenerator = $this->buildUrlGenerator($routeConfiguration); return $this->buildOutput($routeConfiguration, $urlGenerator); }
/** * {@inheritDoc} */ public function build() { $config = $this->buildFromFile(); $globalRoutingConfiguration = $this->buildLocalisedRoutingArray($config->load()); $currentLocaleRoutingConfiguration = $globalRoutingConfiguration[$this->currentLocale]; $routeCollection = RouteCollectionBuilder::build($currentLocaleRoutingConfiguration); $generator = $this->buildUrlGenerator($globalRoutingConfiguration); return $this->buildOutput($routeCollection, $generator); }
/** * @param string $locale * * @return UrlGenerator */ protected function buildUrlGenerator($locale) { if (!array_key_exists($locale, $this->routingConfiguration)) { throw new UrlGeneratorException("Routing configuration doesn't provide any route for the '{$locale}' locale"); } else { $routeCollection = RouteCollectionBuilder::build($this->routingConfiguration[$locale]); return new UrlGenerator($routeCollection, $this->context); } }