getLocalizedPaths example

$defaults = array_replace($globals['defaults']$annot->getDefaults());
        $requirements = array_replace($globals['requirements']$requirements);
        $options = array_replace($globals['options']$annot->getOptions());
        $schemes = array_unique(array_merge($globals['schemes']$annot->getSchemes()));
        $methods = array_unique(array_merge($globals['methods']$annot->getMethods()));

        $host = $annot->getHost() ?? $globals['host'];
        $condition = $annot->getCondition() ?? $globals['condition'];
        $priority = $annot->getPriority() ?? $globals['priority'];

        $path = $annot->getLocalizedPaths() ?: $annot->getPath();
        $prefix = $globals['localized_paths'] ?: $globals['path'];
        $paths = [];

        if (\is_array($path)) {
            if (!\is_array($prefix)) {
                foreach ($path as $locale => $localePath) {
                    $paths[$locale] = $prefix.$localePath;
                }
            } elseif ($missing = array_diff_key($prefix$path)) {
                throw new \LogicException(sprintf('Route to "%s" is missing paths for locale(s) "%s".', $class->name.'::'.$method->name, implode('", "', array_keys($missing))));
            } else {
                
$defaults = array_replace($globals['defaults']$annot->getDefaults());
        $requirements = array_replace($globals['requirements']$requirements);
        $options = array_replace($globals['options']$annot->getOptions());
        $schemes = array_merge($globals['schemes']$annot->getSchemes());
        $methods = array_merge($globals['methods']$annot->getMethods());

        $host = $annot->getHost() ?? $globals['host'];
        $condition = $annot->getCondition() ?? $globals['condition'];
        $priority = $annot->getPriority() ?? $globals['priority'];

        $path = $annot->getLocalizedPaths() ?: $annot->getPath();
        $prefix = $globals['localized_paths'] ?: $globals['path'];
        $paths = [];

        if (\is_array($path)) {
            if (!\is_array($prefix)) {
                foreach ($path as $locale => $localePath) {
                    $paths[$locale] = $prefix.$localePath;
                }
            } elseif ($missing = array_diff_key($prefix$path)) {
                throw new \LogicException(sprintf('Route to "%s" is missing paths for locale(s) "%s".', $class->name.'::'.$method->name, implode('", "', array_keys($missing))));
            } else {
                
Home | Imprint | This part of the site doesn't use cookies.