@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | class UnderstandLaravel5ServiceProvider extends ServiceProvider |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Indicates if loading of the provider is deferred. |
|
| 17 | - * |
|
| 18 | - * @var bool |
|
| 19 | - */ |
|
| 20 | - protected $defer = false; |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Bootstrap the application events. |
|
| 24 | - * |
|
| 25 | - * @return void |
|
| 26 | - */ |
|
| 27 | - public function boot() |
|
| 28 | - { |
|
| 15 | + /** |
|
| 16 | + * Indicates if loading of the provider is deferred. |
|
| 17 | + * |
|
| 18 | + * @var bool |
|
| 19 | + */ |
|
| 20 | + protected $defer = false; |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Bootstrap the application events. |
|
| 24 | + * |
|
| 25 | + * @return void |
|
| 26 | + */ |
|
| 27 | + public function boot() |
|
| 28 | + { |
|
| 29 | 29 | $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
| 30 | 30 | $this->publishes([$configPath => config_path('understand-laravel.php')], 'config'); |
| 31 | 31 | $enabled = $this->app['config']->get('understand-laravel.enabled'); |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $this->registerBladeDirectives(); |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Register Blade directives. |
| 48 | 48 | * |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - protected function registerBladeDirectives() |
|
| 51 | + protected function registerBladeDirectives() |
|
| 52 | 52 | { |
| 53 | 53 | $configuration = UnderstandJsProvider::getJsConfig(); |
| 54 | 54 | |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Register the service provider. |
|
| 100 | - * |
|
| 101 | - * @return void |
|
| 102 | - */ |
|
| 103 | - public function register() |
|
| 104 | - { |
|
| 105 | - $this->registerConfig(); |
|
| 98 | + /** |
|
| 99 | + * Register the service provider. |
|
| 100 | + * |
|
| 101 | + * @return void |
|
| 102 | + */ |
|
| 103 | + public function register() |
|
| 104 | + { |
|
| 105 | + $this->registerConfig(); |
|
| 106 | 106 | $this->registerFieldProvider(); |
| 107 | 107 | $this->registerJsProvider(); |
| 108 | 108 | $this->registerDataCollector(); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $this->registerLogger(); |
| 111 | 111 | $this->registerExceptionEncoder(); |
| 112 | 112 | $this->registerEventLoggers(); |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | 116 | * Register config |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function boot() |
| 28 | 28 | { |
| 29 | - $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
|
| 29 | + $configPath = __DIR__.'/../../config/understand-laravel.php'; |
|
| 30 | 30 | $this->publishes([$configPath => config_path('understand-laravel.php')], 'config'); |
| 31 | 31 | $enabled = $this->app['config']->get('understand-laravel.enabled'); |
| 32 | 32 | |
@@ -55,20 +55,20 @@ discard block |
||
| 55 | 55 | // L5.0 does not support custom directives |
| 56 | 56 | if ($this->detectLaravelVersion(['5.0'])) |
| 57 | 57 | { |
| 58 | - Blade::extend(function ($view, $compiler) use ($configuration) |
|
| 58 | + Blade::extend(function($view, $compiler) use ($configuration) |
|
| 59 | 59 | { |
| 60 | 60 | $pattern = $compiler->createMatcher('understandJsConfig'); |
| 61 | 61 | |
| 62 | 62 | return preg_replace($pattern, json_encode($configuration), $view); |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | - Blade::extend(function ($view, $compiler) use ($configuration) |
|
| 65 | + Blade::extend(function($view, $compiler) use ($configuration) |
|
| 66 | 66 | { |
| 67 | 67 | $pattern = $compiler->createMatcher('understandJs'); |
| 68 | 68 | |
| 69 | - $out = "<script src=\"" . UnderstandJsProvider::getJsBundleUrl() . "\"></script>\r\n"; |
|
| 69 | + $out = "<script src=\"".UnderstandJsProvider::getJsBundleUrl()."\"></script>\r\n"; |
|
| 70 | 70 | $out .= "<script>\r\n"; |
| 71 | - $out .= "Understand.init(" . json_encode($configuration) . ");\r\n"; |
|
| 71 | + $out .= "Understand.init(".json_encode($configuration).");\r\n"; |
|
| 72 | 72 | $out .= "Understand.installErrorHandlers();\r\n"; |
| 73 | 73 | $out .= "</script>"; |
| 74 | 74 | |
@@ -77,16 +77,16 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | else |
| 79 | 79 | { |
| 80 | - Blade::directive('understandJsConfig', function () use ($configuration) |
|
| 80 | + Blade::directive('understandJsConfig', function() use ($configuration) |
|
| 81 | 81 | { |
| 82 | 82 | return json_encode($configuration); |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | - Blade::directive('understandJs', function () use ($configuration) |
|
| 85 | + Blade::directive('understandJs', function() use ($configuration) |
|
| 86 | 86 | { |
| 87 | - $out = "<script src=\"" . UnderstandJsProvider::getJsBundleUrl() . "\"></script>\r\n"; |
|
| 87 | + $out = "<script src=\"".UnderstandJsProvider::getJsBundleUrl()."\"></script>\r\n"; |
|
| 88 | 88 | $out .= "<script>\r\n"; |
| 89 | - $out .= "Understand.init(" . json_encode($configuration) . ");\r\n"; |
|
| 89 | + $out .= "Understand.init(".json_encode($configuration).");\r\n"; |
|
| 90 | 90 | $out .= "Understand.installErrorHandlers();\r\n"; |
| 91 | 91 | $out .= "</script>"; |
| 92 | 92 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected function registerConfig() |
| 121 | 121 | { |
| 122 | - $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
|
| 122 | + $configPath = __DIR__.'/../../config/understand-laravel.php'; |
|
| 123 | 123 | $this->mergeConfigFrom($configPath, 'understand-laravel'); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | return new Handlers\SyncHandler($inputToken, $apiUrl, $sslBundlePath); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - throw new \ErrorException('understand-laravel handler misconfiguration:' . $handlerType); |
|
| 288 | + throw new \ErrorException('understand-laravel handler misconfiguration:'.$handlerType); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -404,13 +404,13 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | // `\Log::info`, `\Log::debug` and NOT `\Exception` or `\Throwable` |
| 407 | - if (in_array($level, ['info', 'debug']) && ! ($message instanceof Exception || $message instanceof Throwable)) |
|
| 407 | + if (in_array($level, ['info', 'debug']) && !($message instanceof Exception || $message instanceof Throwable)) |
|
| 408 | 408 | { |
| 409 | 409 | $this->app['understand.eventLogger']->logEvent($level, $message, $context); |
| 410 | 410 | } |
| 411 | 411 | // `\Log::notice`, `\Log::warning`, `\Log::error`, `\Log::critical`, `\Log::alert`, `\Log::emergency` and `\Exception`, `\Throwable` |
| 412 | 412 | // '5.5', '5.6', '5.7', '5.8' |
| 413 | - else if ( ! $this->detectLaravelVersion(['5.0', '5.1', '5.2', '5.3', '5.4']) && isset($context['exception']) && ($context['exception'] instanceof Exception || $context['exception'] instanceof Throwable)) |
|
| 413 | + else if (!$this->detectLaravelVersion(['5.0', '5.1', '5.2', '5.3', '5.4']) && isset($context['exception']) && ($context['exception'] instanceof Exception || $context['exception'] instanceof Throwable)) |
|
| 414 | 414 | { |
| 415 | 415 | $exception = $context['exception']; |
| 416 | 416 | unset($context['exception']); |
@@ -431,9 +431,9 @@ discard block |
||
| 431 | 431 | */ |
| 432 | 432 | protected function shouldIgnoreEvent($level, $message, $context) |
| 433 | 433 | { |
| 434 | - $ignoredEventTypes = (array)$this->app['config']->get('understand-laravel.ignored_logs'); |
|
| 434 | + $ignoredEventTypes = (array) $this->app['config']->get('understand-laravel.ignored_logs'); |
|
| 435 | 435 | |
| 436 | - if ( ! $ignoredEventTypes) |
|
| 436 | + if (!$ignoredEventTypes) |
|
| 437 | 437 | { |
| 438 | 438 | return false; |
| 439 | 439 | } |
@@ -74,8 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | return preg_replace($pattern, $out, $view); |
| 76 | 76 | }); |
| 77 | - } |
|
| 78 | - else |
|
| 77 | + } else |
|
| 79 | 78 | { |
| 80 | 79 | Blade::directive('understandJsConfig', function () use ($configuration) |
| 81 | 80 | { |
@@ -313,8 +312,7 @@ discard block |
||
| 313 | 312 | { |
| 314 | 313 | $this->handleEvent($level, $message, $context); |
| 315 | 314 | }); |
| 316 | - } |
|
| 317 | - else |
|
| 315 | + } else |
|
| 318 | 316 | { |
| 319 | 317 | // starting from L5.4 MessageLogged event class was introduced |
| 320 | 318 | // https://github.com/laravel/framework/commit/57c82d095c356a0fe0f9381536afec768cdcc072 |
@@ -342,8 +340,7 @@ discard block |
||
| 342 | 340 | $this->app['understand.tokenProvider']->generate(); |
| 343 | 341 | $this->app['understand.dataCollector']->reset(); |
| 344 | 342 | }); |
| 345 | - } |
|
| 346 | - else |
|
| 343 | + } else |
|
| 347 | 344 | { |
| 348 | 345 | $this->app['events']->listen('Illuminate\Queue\Events\JobProcessing', function() |
| 349 | 346 | { |
@@ -373,8 +370,7 @@ discard block |
||
| 373 | 370 | 'time' => $time, |
| 374 | 371 | ]); |
| 375 | 372 | }); |
| 376 | - } |
|
| 377 | - else |
|
| 373 | + } else |
|
| 378 | 374 | { |
| 379 | 375 | // https://laravel.com/api/5.3/Illuminate/Database/Events/QueryExecuted.html |
| 380 | 376 | $this->app['events']->listen('Illuminate\Database\Events\QueryExecuted', function($event) |
@@ -416,8 +412,7 @@ discard block |
||
| 416 | 412 | unset($context['exception']); |
| 417 | 413 | |
| 418 | 414 | $this->app['understand.exceptionLogger']->logError($level, $exception, $context); |
| 419 | - } |
|
| 420 | - else |
|
| 415 | + } else |
|
| 421 | 416 | { |
| 422 | 417 | $this->app['understand.exceptionLogger']->logError($level, $message, $context); |
| 423 | 418 | } |