コード例 #1
0
ファイル: Profiler.php プロジェクト: ndrx-io/profiler-laravel
 /**
  * @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]);
 }
コード例 #2
0
ファイル: Process.php プロジェクト: ndrx-io/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 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)];
 }
コード例 #3
0
ファイル: Bar.php プロジェクト: ndrx-io/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)];
 }
コード例 #4
0
ファイル: Bar.php プロジェクト: ndrx-io/profiler
 /**
  * @param $id
  * @return string
  */
 public function show($id)
 {
     $profile = $this->objectToArray($this->profiler->getProfile($id));
     $renderer = new BarRenderer($profile, $this->profiler);
     return $renderer->content();
 }
コード例 #5
0
ファイル: BarLoader.php プロジェクト: ndrx-io/profiler
 public function getData()
 {
     return ['processId' => $this->profiler->getContext()->getProcess()->getId()];
 }