function OptimizedPhpArrayDumper::getServiceDefinitions
Same name in other branches
- 9 core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::getServiceDefinitions()
- 8.9.x core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::getServiceDefinitions()
- 11.x core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::getServiceDefinitions()
Gets services of the container as a PHP array.
Return value
array The service definitions.
1 call to OptimizedPhpArrayDumper::getServiceDefinitions()
- OptimizedPhpArrayDumper::getArray in core/
lib/ Drupal/ Component/ DependencyInjection/ Dumper/ OptimizedPhpArrayDumper.php - Gets the service container definition as a PHP array.
File
-
core/
lib/ Drupal/ Component/ DependencyInjection/ Dumper/ OptimizedPhpArrayDumper.php, line 126
Class
- OptimizedPhpArrayDumper
- OptimizedPhpArrayDumper dumps a service container as a serialized PHP array.
Namespace
Drupal\Component\DependencyInjection\DumperCode
protected function getServiceDefinitions() {
if (!$this->container
->getDefinitions()) {
return [];
}
$services = [];
foreach ($this->container
->getDefinitions() as $id => $definition) {
// Only store public service definitions, references to shared private
// services are handled in ::getReferenceCall().
if ($definition->isPublic()) {
$service_definition = $this->getServiceDefinition($definition);
$services[$id] = $this->serialize ? serialize($service_definition) : $service_definition;
}
}
return $services;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.