public function onFinish(MvcEvent $mvcEvent) { if ($mvcEvent->getRequest() instanceof ConsoleRequest) { return; } $this->profiler->collect($mvcEvent); if ($this->profiler->needStore()) { $this->storage->save($this->profiler); } }
public function save(Profiler $profiler) { $profile = $profiler->toArray(); $this->dbAdapter->query("INSERT INTO profiler (`method`, `uri`, `response_code`, `execution_time`, `timers`, `created_dt`) VALUES (?, ?, ?, ?, ?, ?)", [$profile['method'], $profile['uri'], $profile['responseCode'], round($profile['execution_time'] * 1000), json_encode($profile['timers']), date('Y-m-d H:i:s')]); }