function ProfilerSubscriber::onKernelFinishRequest

File

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

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();
}