function ExceptionContainer::get

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php \Drupal\FunctionalTests\Bootstrap\ExceptionContainer::get()
  2. 8.9.x core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php \Drupal\FunctionalTests\Bootstrap\ExceptionContainer::get()
  3. 11.x core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php \Drupal\FunctionalTests\Bootstrap\ExceptionContainer::get()

Overrides Container::get

File

core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php, line 18

Class

ExceptionContainer
Base container which throws an exception.

Namespace

Drupal\FunctionalTests\Bootstrap

Code

public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) : ?object {
    if ($id === 'http_kernel') {
        throw new \Exception('Thrown exception during Container::get');
    }
    else {
        return parent::get($id, $invalidBehavior);
    }
}

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