/** * @return mixed */ public function getData() { $collectors = []; $dataCollectors = $this->profiler->getCollectors(); $dataCollectors = call_user_func_array('array_merge', $dataCollectors); foreach ($dataCollectors as $collector) { if ($collector instanceof RenderableInterface) { $renderer = $collector->getRenderer(); if (!$renderer instanceof PageInterface) { continue; } $data = ['value' => null]; if (array_key_exists($collector->getPath(), $this->profile)) { $data['value'] = $this->profile[$collector->getPath()]; } $collectors[$collector->getName()] = $renderer->setData($data); } } return ['collectors' => $collectors, 'bar' => new Bar($this->profile, $this->profiler)]; }
/** * @return mixed */ public function getData() { $collectors = []; $dataCollectors = $this->profiler->getCollectors(); $dataCollectors = call_user_func_array('array_merge', $dataCollectors); foreach ($dataCollectors as $collector) { if ($collector instanceof RenderableInterface) { $renderer = $collector->getRenderer(); if ($renderer instanceof BarInterface) { $data = ['value' => null]; if (array_key_exists($collector->getPath(), $this->profile)) { $data['value'] = $this->profile[$collector->getPath()]; } $renderer->setData($data); $data = ['icon' => $renderer->getIcon(), 'badge' => $renderer->getBadge(), 'content' => $renderer->getBarContent(), 'title' => $renderer->getTitle()]; $collectors[$collector->getName()] = $data; } } } $currenturl = Request::createFromGlobals()->getUri(); return ['collectors' => $collectors, 'profileUrl' => str_replace('bar/', '', $currenturl)]; }