コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }