protected function OptimizedPhpArrayDumper::getServiceDefinitions

protected OptimizedPhpArrayDumper::getServiceDefinitions()

Gets services of the container as a PHP array.

Return value

array The service definitions.

File

core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php, line 115

Class

OptimizedPhpArrayDumper
OptimizedPhpArrayDumper dumps a service container as a serialized PHP array.

Namespace

Drupal\Component\DependencyInjection\Dumper

Code

protected function getServiceDefinitions() {
  if (!$this->container->getDefinitions()) {
    return array();
  }

  $services = array();
  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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!DependencyInjection!Dumper!OptimizedPhpArrayDumper.php/function/OptimizedPhpArrayDumper::getServiceDefinitions/8.1.x