You are here

protected function OptimizedPhpArrayDumper::getPrivateServiceCall in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::getPrivateServiceCall()

Gets a private service definition in a suitable format.

Parameters

string $id: The ID of the service to get a private definition for.

\Symfony\Component\DependencyInjection\Definition $definition: The definition to process.

bool $shared: (optional) Whether the service will be shared with others. By default this parameter is FALSE.

Return value

object A very lightweight private service value object.

2 calls to OptimizedPhpArrayDumper::getPrivateServiceCall()
OptimizedPhpArrayDumper::dumpValue in core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
Dumps the value to PHP array format.
OptimizedPhpArrayDumper::getReferenceCall in core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
Gets a service reference for a reference in a suitable PHP array format.

File

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

Class

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

Namespace

Drupal\Component\DependencyInjection\Dumper

Code

protected function getPrivateServiceCall($id, Definition $definition, $shared = FALSE) {
  $service_definition = $this
    ->getServiceDefinition($definition);
  if (!$id) {
    $hash = Crypt::hashBase64(serialize($service_definition));
    $id = 'private__' . $hash;
  }
  return (object) [
    'type' => 'private_service',
    'id' => $id,
    'value' => $service_definition,
    'shared' => $shared,
  ];
}