当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::error方法代码示例

本文整理汇总了PHP中Illuminate\Foundation\Application::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::error方法的具体用法?PHP Application::error怎么用?PHP Application::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Foundation\Application的用法示例。


在下文中一共展示了Application::error方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: error

 /**
  * Register an application error handler.
  *
  * @param \Closure $callback
  * @return void 
  * @static 
  */
 public static function error($callback)
 {
     \Illuminate\Foundation\Application::error($callback);
 }
开发者ID:nmkr,项目名称:basic-starter,代码行数:11,代码来源:_ide_helper.php

示例2: 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

示例3: 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 \Illuminate\Foundation\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));
         $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->checkVersion('4.1-dev', '>=') && $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('laravel-debugbar::config.options.exceptions.chain', true));
             $this->addCollector($exceptionCollector);
             if ($this->checkVersion('5.0-dev', '<')) {
                 $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 {
             $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) 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 ($this->checkVersion('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));
         }
     }
     if ($this->shouldCollect('log', true)) {
         try {
             if ($this->hasCollector('messages')) {
//.........这里部分代码省略.........
开发者ID:arizawan,项目名称:livetvwithyoutube,代码行数:101,代码来源:LaravelDebugBar.php


注:本文中的Illuminate\Foundation\Application::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。