function TraceableContainer::get
Parameters
string $id:
int $invalidBehavior:
Return value
object
File
-
webprofiler/
src/ DependencyInjection/ TraceableContainer.php, line 34
Class
- TraceableContainer
- Extends the Drupal container class to trace service instantiations.
Namespace
Drupal\webprofiler\DependencyInjectionCode
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) {
if (!$this->stopwatch && $this->has('stopwatch')) {
$this->stopwatch = parent::get('stopwatch');
$this->stopwatch
->openSection();
$this->hasStopwatch = TRUE;
}
if ('stopwatch' === $id) {
return $this->stopwatch;
}
Timer::start($id);
if ($this->hasStopwatch) {
$e = $this->stopwatch
->start($id, 'service');
}
$service = parent::get($id, $invalidBehavior);
$this->tracedData[$id] = Timer::stop($id);
if ($this->hasStopwatch && $e->isStarted()) {
$e->stop();
}
return $service;
}