function it_handles_the_end_of_a_request(IAdapter $adapter, IEvent $event)
 {
     $event->setResponse('response')->shouldBeCalled();
     $event->setLatency(Argument::type('double'))->shouldBeCalled();
     $adapter->save($event)->shouldBeCalled();
     $this->end($event, 'response');
 }
 /**
  * Log the response.
  *
  * @param IEvent $event
  * @param string $response
  *
  * @return IEvent
  */
 public function end(IEvent $event, $response)
 {
     $endTimestamp = microtime(true);
     $event->setResponse($response);
     $event->setLatency($endTimestamp - $this->startTimestamp);
     return $this->adapter->save($event);
 }