Skip to content

Commit

Permalink
Removed comparison method
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdigital committed Mar 10, 2014
1 parent 1202658 commit 5e896aa
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions lib/Cake/Routing/Route/CakeRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,10 @@ protected function _writeUrl($params) {
$out = $this->template;

$search = $replace = array();
$keys = $this->keys;

// Sort the keys in reverse order by length to prevent mismatches
uasort($keys, array($this, '_sortKeys'));
$lengths = array_map('strlen', $this->keys);
$keys = array_combine($lengths, $this->keys);
krsort($keys);

foreach ($keys as $key) {
$string = null;
Expand All @@ -542,15 +542,4 @@ protected function _writeUrl($params) {
return $out;
}

/**
* Comparison method for sorting keys in reverse order by length.
*
* @param $a
* @param $b
* @return int
*/
protected function _sortKeys($a, $b) {
return strlen($a) > strlen($b) ? -1 : 1;
}

}

0 comments on commit 5e896aa

Please sign in to comment.