/** * @return \Illuminate\Http\JsonResponse */ public function clear() { try { $this->profiler->getDatasource()->clear(); } catch (\Exception $e) { return response()->json(['error' => $e->getMessage()], 500); } return response()->json(['success' => true]); }
/** * @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)]; }
/** * @param $id * @return string */ public function show($id) { $profile = $this->objectToArray($this->profiler->getProfile($id)); $renderer = new BarRenderer($profile, $this->profiler); return $renderer->content(); }
public function getData() { return ['processId' => $this->profiler->getContext()->getProcess()->getId()]; }