You are here

protected static function RegisterSerializerCompilerPass::flattenAndSort in Replication 8.2

Flattens and 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.

1 call to RegisterSerializerCompilerPass::flattenAndSort()
RegisterSerializerCompilerPass::process in src/RegisterSerializerCompilerPass.php
You can modify the container here before it is dumped to PHP code.

File

src/RegisterSerializerCompilerPass.php, line 76

Class

RegisterSerializerCompilerPass
Adds services tagged 'replication_normalizer' and 'replication_encoder' to the Serializer.

Namespace

Drupal\replication

Code

protected static function flattenAndSort($services) {
  $sorted = [];
  krsort($services);

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