Beispiel #1
0
 /**
  * @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]);
 }
Beispiel #2
0
 /**
  * @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)];
 }
Beispiel #3
0
 /**
  * @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)];
 }
Beispiel #4
0
 /**
  * @param $id
  * @return string
  */
 public function show($id)
 {
     $profile = $this->objectToArray($this->profiler->getProfile($id));
     $renderer = new BarRenderer($profile, $this->profiler);
     return $renderer->content();
 }
Beispiel #5
0
 public function getData()
 {
     return ['processId' => $this->profiler->getContext()->getProcess()->getId()];
 }