listeners[] = $events->attach( MvcEvent::EVENT_FINISH, [$this, 'onFinish'], Profiler::PRIORITY_FLUSH ); } /** * MvcEvent::EVENT_FINISH event callback * * @param MvcEvent $event */ public function onFinish(MvcEvent $event) { $response = $event->getResponse(); if (! $response instanceof ResponseInterface) { return; } if (is_callable([$response, 'send'])) { return $response->send(); } } }