/** * {@inheritdoc} */ protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method) { // If the annotation is not the Multisite's one, call parent method if (!$annot instanceof RouteAnnotation) { return parent::addRoute($collection, $annot, $globals, $class, $method); } // mono-route if (null === $annot->getPaths()) { return parent::addRoute($collection, $annot, $globals, $class, $method); } return $this->addMultisiteRoute($collection, $annot, $globals, $class, $method); }
/** * @param RouteCollection $collection * @param $annot * @param $globals * @param \ReflectionClass $class * @param \ReflectionMethod $method */ protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method) { $i18n = isset($annot->data['i18n']) ? $annot->data['i18n'] : true; unset($annot->data['i18n']); foreach ($this->registry->getRegisteredLocales() as $locale) { $i18nAnnot = new Route($annot->data); $i18nGlobals = $globals; if ($i18n) { $i18nAnnot->setName($this->helper->alterName($i18nAnnot->getName(), $locale)); $i18nAnnot->setPath($this->helper->alterPath($i18nAnnot->getPath(), $locale)); $i18nAnnot->setDefaults($this->helper->alterDefaults($i18nAnnot->getDefaults(), $locale)); if (isset($i18nGlobals['path']) && !empty($i18nGlobals['path'])) { $i18nGlobals['path'] = '/' . $locale . '/' . ltrim($this->helper->alterPath($i18nGlobals['path'], $locale), '/'); } else { $i18nGlobals['path'] = '/' . $locale; } } parent::addRoute($collection, $i18nAnnot, $i18nGlobals, $class, $method); } }