protected function RouteProvider::routeProviderRouteCompare in Drupal 9
Same name in this branch
- 9 core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::routeProviderRouteCompare()
- 9 core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::routeProviderRouteCompare()
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Routing/RouteProvider.php \Drupal\Core\Routing\RouteProvider::routeProviderRouteCompare()
Comparison function for usort on routes.
File
- core/
lib/ Drupal/ Core/ Routing/ RouteProvider.php, line 389
Class
- RouteProvider
- A Route Provider front-end for all Drupal-stored routes.
Namespace
Drupal\Core\RoutingCode
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;
}