/**
  * @param EndRequestEvent $event
  */
 public function onEndRequest(EndRequestEvent $event)
 {
     $this->requestLogger->endRequest($event->getDirectResponse());
     if ($this->logger) {
         $this->logger->debug('Ext.direct response sent: {response}', ['response' => json_encode($event->getDirectResponse())]);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     if (method_exists($this, 'cloneVar')) {
         $this->data['request'] = $this->cloneVar($this->requestLogger->getRequest(false));
         $this->data['response'] = $this->cloneVar($this->requestLogger->getResponse(false));
         $this->data['time'] = $this->requestLogger->getElapsedTime();
     } else {
         $this->data['request'] = $this->varToString($this->requestLogger->getRequest(false));
         $this->data['response'] = $this->varToString($this->requestLogger->getResponse(false));
         $this->data['time'] = $this->requestLogger->getElapsedTime();
     }
 }