예제 #1
0
 /** Appends a pre-built route to the dispatcher */
 public function appendRoute(AbstractRoute $route)
 {
     $this->routes[] = $route;
     foreach ($this->globalRoutines as $routine) {
         $route->appendRoutine($routine);
     }
 }
예제 #2
0
 public function appendRoute(AbstractRoute $route)
 {
     $this->routes[] = $route;
     foreach ($this->globalRoutines as $routine) {
         $route->appendRoutine($routine);
     }
     usort($this->routes, function ($a, $b) {
         $a = $a->getPath();
         $b = $b->getPath();
         if (0 === stripos($a, $b)) {
             return 1;
         } elseif (0 === stripos($b, $a)) {
             return -1;
         } elseif (substr_count($a, '/') < substr_count($b, '/')) {
             return 1;
         }
         return substr_count($a, AbstractRoute::PARAM_IDENTIFIER) < substr_count($b, AbstractRoute::PARAM_IDENTIFIER) ? -1 : 1;
     });
 }