當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::isBooted方法代碼示例

本文整理匯總了PHP中Illuminate\Foundation\Application::isBooted方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::isBooted方法的具體用法?PHP Application::isBooted怎麽用?PHP Application::isBooted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Foundation\Application的用法示例。


在下文中一共展示了Application::isBooted方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: boot

 /**
  * Boot the debugbar (add collectors, renderer and listener)
  */
 public function boot()
 {
     if ($this->booted) {
         return;
     }
     $debugbar = $this;
     $app = $this->app;
     if ($this->app['config']->get('laravel-debugbar::config.storage.enabled')) {
         $path = $this->app['config']->get('laravel-debugbar::config.storage.path');
         $storage = new FilesystemStorage($this->app['files'], $path);
         $debugbar->setStorage($storage);
     }
     if ($this->shouldCollect('phpinfo', true)) {
         $this->addCollector(new PhpInfoCollector());
     }
     if ($this->shouldCollect('messages', true)) {
         $this->addCollector(new MessagesCollector());
     }
     if ($this->shouldCollect('time', true)) {
         $this->addCollector(new TimeDataCollector());
         $this->app->booted(function () use($debugbar) {
             if (defined('LARAVEL_START')) {
                 $debugbar['time']->addMeasure('Booting', LARAVEL_START, microtime(true));
             }
         });
         //Check if App::before is already called..
         if (version_compare($app::VERSION, '4.1', '>=') && $this->app->isBooted()) {
             $debugbar->startMeasure('application', 'Application');
         } else {
             $this->app->before(function () use($debugbar) {
                 $debugbar->startMeasure('application', 'Application');
             });
         }
         $this->app->after(function () use($debugbar) {
             $debugbar->stopMeasure('application');
             $debugbar->startMeasure('after', 'After application');
         });
     }
     if ($this->shouldCollect('memory', true)) {
         $this->addCollector(new MemoryCollector());
     }
     if ($this->shouldCollect('exceptions', true)) {
         try {
             $exceptionCollector = new ExceptionsCollector();
             if (method_exists($exceptionCollector, 'setChainExceptions')) {
                 $exceptionCollector->setChainExceptions($this->app['config']->get('laravel-debugbar::config.options.exceptions.chain', true));
             }
             $this->addCollector($exceptionCollector);
             $this->app->error(function (Exception $exception) use($exceptionCollector) {
                 $exceptionCollector->addException($exception);
             });
         } catch (\Exception $e) {
         }
     }
     if ($this->shouldCollect('laravel', false)) {
         $this->addCollector(new LaravelCollector($this->app));
     }
     if ($this->shouldCollect('default_request', false)) {
         $this->addCollector(new RequestDataCollector());
     }
     if ($this->shouldCollect('events', false) and isset($this->app['events'])) {
         try {
             $this->addCollector(new MessagesCollector('events'));
             $dispatcher = $this->app['events'];
             $dispatcher->listen('*', function () use($debugbar, $dispatcher) {
                 if (method_exists($dispatcher, 'firing')) {
                     $event = $dispatcher->firing();
                 } else {
                     $args = func_get_args();
                     $event = end($args);
                 }
                 $debugbar['events']->info("Received event: " . $event);
             });
         } catch (\Exception $e) {
             $this->addException(new Exception('Cannot add EventCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
     }
     if ($this->shouldCollect('views', true) and isset($this->app['events'])) {
         try {
             $collectData = $this->app['config']->get('laravel-debugbar::config.options.views.data', true);
             $this->addCollector(new ViewCollector($collectData));
             $this->app['events']->listen('composing:*', function ($view) use($debugbar) {
                 $debugbar['views']->addView($view);
             });
         } catch (\Exception $e) {
             $this->addException(new Exception('Cannot add ViewCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
     }
     if ($this->shouldCollect('route')) {
         try {
             if (version_compare($app::VERSION, '4.1', '>=')) {
                 $this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\IlluminateRouteCollector'));
             } else {
                 $this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\SymfonyRouteCollector'));
             }
         } catch (\Exception $e) {
             $this->addException(new Exception('Cannot add RouteCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
//.........這裏部分代碼省略.........
開發者ID:cenwj,項目名稱:sns,代碼行數:101,代碼來源:LaravelDebugBar.php

示例2: boot

 /**
  * Boot the debugbar (add collectors, renderer and listener)
  */
 public function boot()
 {
     if ($this->booted) {
         return;
     }
     if ($this->isDebugbarRequest()) {
         $this->app['session']->reflash();
     }
     /** @var \Barryvdh\Debugbar\LaravelDebugbar $debugbar */
     $debugbar = $this;
     /** @var Application $app */
     $app = $this->app;
     $this->selectStorage($debugbar);
     if ($this->shouldCollect('phpinfo', true)) {
         $this->addCollector(new PhpInfoCollector());
     }
     if ($this->shouldCollect('messages', true)) {
         $this->addCollector(new MessagesCollector());
     }
     if ($this->shouldCollect('time', true)) {
         $startTime = defined('LARAVEL_START') ? LARAVEL_START : null;
         $this->addCollector(new TimeDataCollector($startTime));
         if ($this->isLumen()) {
             $debugbar->startMeasure('application', 'Application');
         } else {
             $this->app->booted(function () use($debugbar, $startTime) {
                 if ($startTime) {
                     $debugbar['time']->addMeasure('Booting', $startTime, microtime(true));
                 }
             });
             //Check if App::before is already called..
             if ($this->app->isBooted()) {
                 $debugbar->startMeasure('application', 'Application');
             } else {
                 $this->app['router']->before(function () use($debugbar) {
                     $debugbar->startMeasure('application', 'Application');
                 });
             }
             $this->app['router']->after(function () use($debugbar) {
                 $debugbar->stopMeasure('application');
                 $debugbar->startMeasure('after', 'After application');
             });
         }
     }
     if ($this->shouldCollect('memory', true)) {
         $this->addCollector(new MemoryCollector());
     }
     if ($this->shouldCollect('exceptions', true)) {
         try {
             $exceptionCollector = new ExceptionsCollector();
             $exceptionCollector->setChainExceptions($this->app['config']->get('debugbar.options.exceptions.chain', true));
             $this->addCollector($exceptionCollector);
         } catch (\Exception $e) {
         }
     }
     if ($this->shouldCollect('laravel', false)) {
         $this->addCollector(new LaravelCollector($this->app));
     }
     if ($this->shouldCollect('default_request', false)) {
         $this->addCollector(new RequestDataCollector());
     }
     if ($this->shouldCollect('events', false) && isset($this->app['events'])) {
         try {
             $startTime = defined('LARAVEL_START') ? LARAVEL_START : null;
             $eventCollector = new EventCollector($startTime);
             $this->addCollector($eventCollector);
             $this->app['events']->subscribe($eventCollector);
         } catch (\Exception $e) {
             $this->addException(new Exception('Cannot add EventCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
     }
     if ($this->shouldCollect('views', true) && isset($this->app['events'])) {
         try {
             $collectData = $this->app['config']->get('debugbar.options.views.data', true);
             $this->addCollector(new ViewCollector($collectData));
             $this->app['events']->listen('composing:*', function ($view) use($debugbar) {
                 $debugbar['views']->addView($view);
             });
         } catch (\Exception $e) {
             $this->addException(new Exception('Cannot add ViewCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
     }
     if (!$this->isLumen() && $this->shouldCollect('route')) {
         try {
             $this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\IlluminateRouteCollector'));
         } catch (\Exception $e) {
             $this->addException(new Exception('Cannot add RouteCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
         }
     }
     if (!$this->isLumen() && $this->shouldCollect('log', true)) {
         try {
             if ($this->hasCollector('messages')) {
                 $logger = new MessagesCollector('log');
                 $this['messages']->aggregate($logger);
                 $this->app['log']->listen(function ($level, $message, $context) use($logger) {
                     try {
                         $logMessage = (string) $message;
//.........這裏部分代碼省略.........
開發者ID:crstestacc,項目名稱:laravel-debugbar,代碼行數:101,代碼來源:LaravelDebugbar.php

示例3: isBooted

 /**
  * Determine if the application has booted.
  *
  * @return bool 
  * @static 
  */
 public static function isBooted()
 {
     return \Illuminate\Foundation\Application::isBooted();
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:10,代碼來源:_ide_helper.php

示例4: boot

 /**
  * Boot the debugbar (add collectors, renderer and listener)
  */
 public function boot()
 {
     if ($this->booted) {
         return;
     }
     $debugbar = $this;
     $app = $this->app;
     if ($this->app['config']->get('laravel-debugbar::config.storage.enabled')) {
         $path = $this->app['config']->get('laravel-debugbar::config.storage.path');
         $storage = new FilesystemStorage($this->app['files'], $path);
         $debugbar->setStorage($storage);
     }
     if ($this->shouldCollect('phpinfo', true)) {
         $this->addCollector(new PhpInfoCollector());
     }
     if ($this->shouldCollect('messages', true)) {
         $this->addCollector(new MessagesCollector());
     }
     if ($this->shouldCollect('time', true)) {
         $this->addCollector(new TimeDataCollector());
         $this->app->booted(function () use($debugbar) {
             if (defined('LARAVEL_START')) {
                 $debugbar['time']->addMeasure('Booting', LARAVEL_START, microtime(true));
             }
         });
         //Check if App::before is already called..
         if (version_compare($app::VERSION, '4.1', '>=') && $this->app->isBooted()) {
             $debugbar->startMeasure('application', 'Application');
         } else {
             $this->app->before(function () use($debugbar) {
                 $debugbar->startMeasure('application', 'Application');
             });
         }
         $this->app->after(function () use($debugbar) {
             $debugbar->stopMeasure('application');
             $debugbar->startMeasure('after', 'After application');
         });
     }
     if ($this->shouldCollect('memory', true)) {
         $this->addCollector(new MemoryCollector());
     }
     if ($this->shouldCollect('exceptions', true)) {
         $this->addCollector(new ExceptionsCollector());
     }
     if ($this->shouldCollect('laravel', false)) {
         $this->addCollector(new LaravelCollector());
     }
     if ($this->shouldCollect('default_request', false)) {
         $this->addCollector(new RequestDataCollector());
     }
     if ($this->shouldCollect('events', false) and isset($this->app['events'])) {
         $this->addCollector(new MessagesCollector('events'));
         $dispatcher = $this->app['events'];
         $dispatcher->listen('*', function () use($debugbar, $dispatcher) {
             if (method_exists($dispatcher, 'firing')) {
                 $event = $dispatcher->firing();
             } else {
                 $args = func_get_args();
                 $event = end($args);
             }
             $debugbar['events']->info("Received event: " . $event);
         });
     }
     if ($this->shouldCollect('views', true) and isset($this->app['events'])) {
         $collectData = $this->app['config']->get('laravel-debugbar::config.options.views.data', true);
         $this->addCollector(new ViewCollector($collectData));
         $this->app['events']->listen('composing:*', function ($view) use($debugbar) {
             $debugbar['views']->addView($view);
         });
     }
     if ($this->shouldCollect('route')) {
         if (version_compare($app::VERSION, '4.1', '>=')) {
             $this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\IlluminateRouteCollector'));
         } else {
             $this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\SymfonyRouteCollector'));
         }
     }
     if ($this->shouldCollect('log', true)) {
         if ($this->hasCollector('messages')) {
             $logger = new MessagesCollector('log');
             $this['messages']->aggregate($logger);
             $this->app['log']->listen(function ($level, $message, $context) use($logger) {
                 if (is_array($message) or is_object($message)) {
                     $message = json_encode($message);
                 }
                 $log = '[' . date('H:i:s') . '] ' . "LOG.{$level}: " . $message . (!empty($context) ? ' ' . json_encode($context) : '');
                 $logger->addMessage($log, $level);
             });
         } else {
             $this->addCollector(new MonologCollector($this->app['log']->getMonolog()));
         }
     }
     if ($this->shouldCollect('db', true) and isset($this->app['db'])) {
         try {
             $pdo = new TraceablePDO($this->app['db']->getPdo());
             $pdoCollector = new PDOCollector($pdo);
             if ($this->app['config']->get('laravel-debugbar::config.options.pdo.with_params')) {
//.........這裏部分代碼省略.........
開發者ID:aaronbullard,項目名稱:litmus,代碼行數:101,代碼來源:LaravelDebugBar.php


注:本文中的Illuminate\Foundation\Application::isBooted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。