You are here

public function ProfilerSubscriber::onKernelFinishRequest in Devel 8.3

Same name and namespace in other branches
  1. 8 webprofiler/src/EventSubscriber/ProfilerSubscriber.php \Drupal\webprofiler\EventSubscriber\ProfilerSubscriber::onKernelFinishRequest()
  2. 8.2 webprofiler/src/EventSubscriber/ProfilerSubscriber.php \Drupal\webprofiler\EventSubscriber\ProfilerSubscriber::onKernelFinishRequest()
  3. 4.x webprofiler/src/EventSubscriber/ProfilerSubscriber.php \Drupal\webprofiler\EventSubscriber\ProfilerSubscriber::onKernelFinishRequest()

File

webprofiler/src/EventSubscriber/ProfilerSubscriber.php, line 103

Class

ProfilerSubscriber

Namespace

Drupal\webprofiler\EventSubscriber

Code

public function onKernelFinishRequest(FinishRequestEvent $event) {

  // Attach children to parents.
  foreach ($this->profiles as $request) {
    if (NULL !== ($parentRequest = $this->parents[$request])) {
      if (isset($this->profiles[$parentRequest])) {
        $this->profiles[$parentRequest]
          ->addChild($this->profiles[$request]);
      }
    }
  }

  // Save profiles.
  foreach ($this->profiles as $request) {
    $this->profiler
      ->saveProfile($this->profiles[$request]);
  }
  $this->profiles = new \SplObjectStorage();
  $this->parents = new \SplObjectStorage();
}