You are here

private function UpdateCompilerPass::isArgumentMissingService in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Update/UpdateCompilerPass.php \Drupal\Core\Update\UpdateCompilerPass::isArgumentMissingService()
  2. 10 core/lib/Drupal/Core/Update/UpdateCompilerPass.php \Drupal\Core\Update\UpdateCompilerPass::isArgumentMissingService()

Checks if a reference argument is to a missing service.

Parameters

mixed $argument: The argument to check.

\Symfony\Component\DependencyInjection\ContainerBuilder $container: The container.

Return value

bool TRUE if the argument is a reference to a service that is missing from the container and the reference is required, FALSE if not.

1 call to UpdateCompilerPass::isArgumentMissingService()
UpdateCompilerPass::process in core/lib/Drupal/Core/Update/UpdateCompilerPass.php
You can modify the container here before it is dumped to PHP code.

File

core/lib/Drupal/Core/Update/UpdateCompilerPass.php, line 85

Class

UpdateCompilerPass
Removes services with unmet dependencies.

Namespace

Drupal\Core\Update

Code

private function isArgumentMissingService($argument, ContainerBuilder $container) {
  if ($argument instanceof Reference) {
    $argument_id = (string) $argument;
    if (!$container
      ->has($argument_id) && $argument
      ->getInvalidBehavior() === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
      return TRUE;
    }
  }
  return FALSE;
}