You are here

public function ProfilerListener::onKernelResponse in Zircon Profile 8.0

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

Handles the onKernelResponse event.

Parameters

FilterResponseEvent $event A FilterResponseEvent instance:

File

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

Class

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

Namespace

Symfony\Component\HttpKernel\EventListener

Code

public function onKernelResponse(FilterResponseEvent $event) {
  $master = $event
    ->isMasterRequest();
  if ($this->onlyMasterRequests && !$master) {
    return;
  }
  if ($this->onlyException && null === $this->exception) {
    return;
  }
  $request = $event
    ->getRequest();
  $exception = $this->exception;
  $this->exception = null;
  if (null !== $this->matcher && !$this->matcher
    ->matches($request)) {
    return;
  }
  if (!($profile = $this->profiler
    ->collect($request, $event
    ->getResponse(), $exception))) {
    return;
  }
  $this->profiles[$request] = $profile;
  if (null !== $this->requestStack) {
    $this->parents[$request] = $this->requestStack
      ->getParentRequest();
  }
  elseif (!$master) {

    // to be removed when requestStack is required
    array_pop($this->requests);
    $this->parents[$request] = end($this->requests);
  }
}