public function ErrorContainer::get in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Bootstrap/ErrorContainer.php \Drupal\system\Tests\Bootstrap\ErrorContainer::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/ ErrorContainer.php, line 20 - Contains \Drupal\system\Tests\Bootstrap\ErrorContainer.
Class
- ErrorContainer
- Container base class which triggers an error.
Namespace
Drupal\system\Tests\BootstrapCode
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
if ($id === 'http_kernel') {
// Enforce a recoverable error.
$callable = function (ErrorContainer $container) {
};
$callable(1);
}
else {
return parent::get($id, $invalidBehavior);
}
}