routes) && count($this->routes) > 0) { uasort($this->routes, function (Route $a, Route $b) { return $a->getWeight() > $b->getWeight(); }); foreach ($this->routes as $index => $route) { if (!isset($allocatedRoutes[$route->getHttpMethod().$route->getRouterPattern()])) { $allocatedRoutes[$route->getHttpMethod().$route->getRouterPattern()] = true; } else { unset($this->routes[$index]); } } } return $this; } public function populateRoutes(App $app) { $this->weighRoutes(); if (count($this->routes) > 0) { foreach ($this->routes as $route) { $app = $route->populateRoute($app); } } return $app; } public function addRoute(Route $route) { $this->routes[$route->getUniqueIdentifier()] = $route; return $this; } /** * @return Route[] */ public function getRoutes() { ksort($this->routes); return $this->routes; } }