Skip to content

Commit

Permalink
Switch to using array_index() to search routes.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 14, 2012
1 parent 1f164f0 commit a08f4e7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/Cake/Routing/RouteCollection.php
Expand Up @@ -175,8 +175,8 @@ public function parse($url) {

/**
* Promote a route (by default, the last one added) to the beginning of the list.
* Also promotes the route to the head of its named slice in the route
* hashtable.
* Also promotes the route to the head of its named slice in the named route
* table.
*
* @param integer $which A zero-based array index representing
* the route to move. For example,
Expand All @@ -197,11 +197,7 @@ public function promote($which) {

$name = $route->getName();
$routes = $this->_routeTable[$name];
foreach ($routes as $i => $otherRoute) {
if ($route == $otherRoute) {
$index = $i;
}
}
$index = array_search($route, $routes, true);
unset($this->_routeTable[$name][$index]);
array_unshift($this->_routeTable[$name], $route);
return true;
Expand Down

0 comments on commit a08f4e7

Please sign in to comment.