You are here

public function ContainerBuilder::resolveServices in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::resolveServices()

Replaces service references by the real service instance and evaluates expressions.

Parameters

mixed $value A value:

Return value

mixed The same value with all service references replaced by the real service instances and all expressions evaluated

3 calls to ContainerBuilder::resolveServices()
ContainerBuilder::callMethod in vendor/symfony/dependency-injection/ContainerBuilder.php
ContainerBuilder::callMethod in core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php
A 1to1 copy of parent::callMethod.
ContainerBuilder::createService in vendor/symfony/dependency-injection/ContainerBuilder.php
Creates a service for a service definition.

File

vendor/symfony/dependency-injection/ContainerBuilder.php, line 938

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function resolveServices($value) {
  if (is_array($value)) {
    foreach ($value as $k => $v) {
      $value[$k] = $this
        ->resolveServices($v);
    }
  }
  elseif ($value instanceof Reference) {
    $value = $this
      ->get((string) $value, $value
      ->getInvalidBehavior());
  }
  elseif ($value instanceof Definition) {
    $value = $this
      ->createService($value, null);
  }
  elseif ($value instanceof Expression) {
    $value = $this
      ->getExpressionLanguage()
      ->evaluate($value, array(
      'container' => $this,
    ));
  }
  return $value;
}