RouteProvider::routeProviderRouteCompare

protected RouteProvider::routeProviderRouteCompare(array $a, array $b)

Comparison function for usort on routes.

File

core/lib/Drupal/Core/Routing/RouteProvider.php, line 363

Class

RouteProvider
A Route Provider front-end for all Drupal-stored routes.

Namespace

Drupal\Core\Routing

Code

protected function routeProviderRouteCompare(array $a, array $b) {
  if ($a['fit'] == $b['fit']) {
    return strcmp($a['name'], $b['name']);
  }
  // Reverse sort from highest to lowest fit. PHP should cast to int, but
  // the explicit cast makes this sort more robust against unexpected input.
  return (int) $a['fit'] < (int) $b['fit'] ? 1 : -1;
}
doc_Drupal
2016-10-29 09:39:19
Comments
Leave a Comment

Please login to continue.