function OptimizedPhpArrayDumper::getPrivateServiceCall

Same name in other branches
  1. 9 core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::getPrivateServiceCall()
  2. 8.9.x core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::getPrivateServiceCall()
  3. 11.x 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|null $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 367

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,
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.