Rest is added in Service Provider
Inheritance: extends DebugBar\DebugBar
 public function register()
 {
     $configPath = $this->configPath;
     $this->di->set('config.debugbar', function () use($configPath) {
         $base = new Php(__DIR__ . '/config/debugbar.php');
         $base['collectors']['phpinfo'] = true;
         $base['collectors']['time'] = true;
         $base['collectors']['messages'] = true;
         if (is_string($configPath) && is_file($configPath)) {
             $config = new Php($configPath);
             $base->merge($config);
         } elseif (is_object($configPath) && $configPath instanceof Php) {
             $base->merge($configPath);
         } else {
         }
         return $base;
     }, true);
     $this->di->set('debugbar', function () {
         $di = Version::getId() > 2010000 ? $this : $this->di;
         $debugbar = new PhalconDebugbar($di);
         $debugbar->setHttpDriver(new PhalconHttpDriver());
         return $debugbar;
     });
     $this->setRoute();
     return $this;
 }
Beispiel #2
0
 protected function isAggregate($aggregate)
 {
     if ($aggregate && $this->_debugbar->hasCollector('messages') && $this->_debugbar->shouldCollect('messages')) {
         return true;
     }
     return false;
 }
 protected function logInternal($message, $type, $time, $context)
 {
     if ($this->_debugbar->hasCollector('log') && $this->_debugbar->shouldCollect('log')) {
         // Phalcon\Logger\Adapter::log方法调用logInternal时传入的时间精确到秒,精确度太低,因此此处提高精确度
         $this->_debugbar->getCollector('log')->add($message, $type, microtime(true), $context);
     }
 }
 public function register()
 {
     $configPath = $this->configPath;
     $this->di->set('config.debugbar', function () use($configPath) {
         $base = new Php(__DIR__ . '/config/debugbar.php');
         $base['collectors']['phpinfo'] = true;
         $base['collectors']['time'] = true;
         $base['collectors']['messages'] = true;
         if (is_string($configPath) && is_file($configPath)) {
             $extension = strtolower(pathinfo($configPath, PATHINFO_EXTENSION));
             switch ($extension) {
                 case 'ini':
                     $config = new Ini($configPath);
                     break;
                 case 'json':
                     $config = new Json($configPath);
                     break;
                 case 'php':
                 case 'php5':
                 case 'inc':
                     $config = new Php($configPath);
                     break;
                 case 'yml':
                 case 'yaml':
                     $config = new Yaml($configPath);
                     break;
                 default:
                     throw new \RuntimeException(sprintf('Config adapter for %s files is not support', $extension));
             }
             $base->merge($config);
         } elseif (is_object($configPath) && $configPath instanceof Config) {
             $base->merge($configPath);
         } else {
         }
         return $base;
     }, true);
     $this->di->set('debugbar', function () {
         $di = Version::getId() > 2010000 ? $this : $this->di;
         $debugbar = new PhalconDebugbar($di);
         $debugbar->setHttpDriver(new PhalconHttpDriver());
         return $debugbar;
     });
     $this->setRoute();
     return $this;
 }