You are here

public function ProfilerSubscriber::onKernelResponse in Devel 8.3

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

Handles the onKernelResponse event.

File

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

Class

ProfilerSubscriber

Namespace

Drupal\webprofiler\EventSubscriber

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;
  $this->parents[$request] = $this->requestStack
    ->getParentRequest();
}