public function getRouteCollection() { //@todo: maybe consider route collection as frozen if ($this->routeCollection) { return $this->routeCollection; } $routeCollection = new RouteCollection(); foreach ($this->routes as $route) { $pattern = $this->container->replaceParametersScalar($route['config']['configuration']['prefix'] . $route['params']['pattern']); $routeObj = new Route($pattern, array_merge($route['config']['configuration']['defaults'], $route['params']['defaults'], array('controller' => $route['params']['controller'])), $route['params']['requirements'], $route['params']['options']); $routeCollection->add($route['name'], $routeObj); } $this->routes = array(); return $this->routeCollection = $routeCollection; }