protected function transformResultsToRoutes(array $results)
    {
        $routes = [];
        foreach ($results as $result) {
            $name = $result['route'];
            if (array_key_exists($name, $routes)) {
                /** @var Route $route */
                $route = $routes[$name];
                $paths = $route->getOption('i18n_paths');
                $paths[$result['locale']] = $result['path'];
                $route->setOption('i18n_paths', $paths);
            } else {
                $route = new Route($result['path']);
                if (!array_key_exists($result['controller'], $this->config['controllers'])) {
                    throw new \RuntimeException(sprintf('Undefined controller "%s".', $result['controller']));
                }
                $paths = [$result['locale'] => $result['path']];
                $route
                    ->setDefault('_controller', $this->config['controllers'][$result['controller']]['value'])
                    ->setMethods(['GET'])
                    ->setOption('i18n_paths', $paths)
                ;
                $routes[$name] = $route;
            }
        }
        // TODO check that i18n_paths are set for all locales ?
        return $routes;
    }
protected function transformResultsToRoutes(array $results)
    {
        $routes = [];
        foreach ($results as $result) {
            $name = $result['route'];
            if (array_key_exists($name, $routes)) {
                /** @var Route $route */
                $route = $routes[$name];
                $paths = $route->getOption('i18n_paths');
                $paths[$result['locale']] = $result['path'];
                $route->setOption('i18n_paths', $paths);
            } else {
                $route = new Route($result['path']);
                if (!array_key_exists($result['controller'], $this->config['controllers'])) {
                    throw new \RuntimeException(sprintf('Undefined controller "%s".', $result['controller']));
                }
                $paths = [$result['locale'] => $result['path']];
                $route
                    ->setDefault('_controller', $this->config['controllers'][$result['controller']]['value'])
                    ->setMethods(['GET'])
                    ->setOption('i18n_paths', $paths)
                ;
                $routes[$name] = $route;
            }
        }
        // TODO check that i18n_paths are set for all locales ?
        return $routes;
    }
protected function transformResultsToRoutes ( array $ results ) { $ routes = [ ] ; foreach ( $ results as $ result ) { $ name = $ result [ 'route' ] ; if ( array_key_exists ( $ name , $ routes ) ) { /** @var Route $route */ $ route = $ routes [ $ name ] ; $ paths = $ route -> getOption ( 'i18n_paths' ) ; $ paths [ $ result [ 'locale' ] ] = $ result [ 'path' ] ; $ route -> setOption ( 'i18n_paths' , $ paths ) ; } else { $ route = new Route ( $ result [ 'path' ] ) ; if ( ! array_key_exists ( $ result [ 'controller' ] , $ this -> config [ 'controllers' ] ) ) { throw new \ RuntimeException ( sprintf ( 'Undefined controller "%s".' , $ result [ 'controller' ] ) ) ; } $ paths = [ $ result [ 'locale' ] => $ result [ 'path' ] ] ; $ route -> setDefault ( '_controller' , $ this -> config [ 'controllers' ] [ $ result [ 'controller' ] ] [ 'value' ] ) -> setMethods ( [ 'GET' ] ) -> setOption ( 'i18n_paths' , $ paths ) ; $ routes [ $ name ] = $ route ; } } // TODO check that i18n_paths are set for all locales ? return $ routes ; }
Transforms the array results into routes.

@param array $results
@return array|Route[]
Transforms the array results into routes .