function RegisterSerializationClassesCompilerPass::sort
Same name in other branches
- 9 core/modules/serialization/src/RegisterSerializationClassesCompilerPass.php \Drupal\serialization\RegisterSerializationClassesCompilerPass::sort()
- 8.9.x core/modules/serialization/src/RegisterSerializationClassesCompilerPass.php \Drupal\serialization\RegisterSerializationClassesCompilerPass::sort()
- 11.x core/modules/serialization/src/RegisterSerializationClassesCompilerPass.php \Drupal\serialization\RegisterSerializationClassesCompilerPass::sort()
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.
2 calls to RegisterSerializationClassesCompilerPass::sort()
- RegisterSerializationClassesCompilerPass::process in core/
modules/ serialization/ src/ RegisterSerializationClassesCompilerPass.php - phpcs:ignore Drupal.Commenting.FunctionComment.VoidReturn
- RegisterSerializationClassesCompilerPass::process in core/
modules/ jsonapi/ src/ DependencyInjection/ Compiler/ RegisterSerializationClassesCompilerPass.php - Adds services to the JSON:API Serializer.
File
-
core/
modules/ serialization/ src/ RegisterSerializationClassesCompilerPass.php, line 76
Class
- RegisterSerializationClassesCompilerPass
- Adds services tagged 'normalizer' and 'encoder' to the Serializer.
Namespace
Drupal\serializationCode
protected function sort($services) {
krsort($services);
return array_merge(...$services);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.