You are here

protected function ScopeListBuilder::sortAlphabetically in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/ScopeListBuilder.php \Drupal\oauth2_server\ScopeListBuilder::sortAlphabetically()

Sorts an array of entities alphabetically.

Will preserve the key/value association of the array.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityInterface[] $entities: An array of config entities.

1 call to ScopeListBuilder::sortAlphabetically()
ScopeListBuilder::render in src/ScopeListBuilder.php

File

src/ScopeListBuilder.php, line 128

Class

ScopeListBuilder
Builds a listing of oauth2 server entities.

Namespace

Drupal\oauth2_server

Code

protected function sortAlphabetically(array &$entities) {
  uasort($entities, function (ConfigEntityInterface $a, ConfigEntityInterface $b) {
    return strnatcasecmp($a
      ->label(), $b
      ->label());
  });
}