You are here

public function ProfilerListener::onKernelTerminate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/EventListener/ProfilerListener.php \Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelTerminate()

File

vendor/symfony/http-kernel/EventListener/ProfilerListener.php, line 132

Class

ProfilerListener
ProfilerListener collects data for the current request by listening to the kernel events.

Namespace

Symfony\Component\HttpKernel\EventListener

Code

public function onKernelTerminate(PostResponseEvent $event) {

  // attach children to parents
  foreach ($this->profiles as $request) {

    // isset call should be removed when requestStack is required
    if (isset($this->parents[$request]) && 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();
  $this->requests = array();
}