You are here

protected function ClientListBuilder::sortAlphabetically in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/ClientListBuilder.php \Drupal\oauth2_server\ClientListBuilder::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 ClientListBuilder::sortAlphabetically()
ClientListBuilder::render in src/ClientListBuilder.php

File

src/ClientListBuilder.php, line 131

Class

ClientListBuilder
Builds a listing of oauth2 server client entities.

Namespace

Drupal\oauth2_server

Code

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