public function ExceptionContainer::get in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Bootstrap/ExceptionContainer.php \Drupal\system\Tests\Bootstrap\ExceptionContainer::get()
Gets a service.
Parameters
string $id The service identifier:
int $invalidBehavior The behavior when the service does not exist:
Return value
object The associated service
Throws
ServiceCircularReferenceException When a circular reference is detected
ServiceNotFoundException When the service is not defined
Overrides Container::get
See also
Reference
File
- core/
modules/ system/ src/ Tests/ Bootstrap/ ExceptionContainer.php, line 20 - Contains \Drupal\system\Tests\Bootstrap\ExceptionContainer.
Class
- ExceptionContainer
- Base container which throws an exception.
Namespace
Drupal\system\Tests\BootstrapCode
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
if ($id === 'http_kernel') {
throw new \Exception('Thrown exception during Container::get');
}
else {
return parent::get($id, $invalidBehavior);
}
}