public function buildRoutesOrder()
    {
        $comparePriority = function ($r1, $r2) {
            $a = $this->getRoutePriority($r1);
            $b = $this->getRoutePriority($r2);
            if ($a == $b) {
                return 0;
            }

            return ($a < $b) ? 1 : -1;
        };

        uasort($this->allRoutes, $comparePriority);
        foreach (array_keys($this->routes) as $method) {
            uasort($this->routes[$method], $comparePriority);
        }

        return $this;
    }