RegisterEntityResolversCompilerPass::sort

protected RegisterEntityResolversCompilerPass::sort($services)

Sorts by priority.

Order services from highest priority number to lowest (reverse sorting).

Parameters

array $services: A nested array keyed on priority number. For each priority number, the value is an array of Symfony\Component\DependencyInjection\Reference objects, each a reference to a normalizer or encoder service.

Return value

array A flattened array of Reference objects from $services, ordered from high to low priority.

File

core/modules/serialization/src/RegisterEntityResolversCompilerPass.php, line 50

Class

RegisterEntityResolversCompilerPass
Adds services tagged 'normalizer' and 'encoder' to the Serializer.

Namespace

Drupal\serialization

Code

protected function sort($services) {
  $sorted = array();
  krsort($services);

  // Flatten the array.
  foreach ($services as $a) {
    $sorted = array_merge($sorted, $a);
  }

  return $sorted;
}
doc_Drupal
2016-10-29 09:37:05
Comments
Leave a Comment

Please login to continue.