@@ -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 | // L5.0 does not support custom directives |
| 54 | 54 | if ($this->detectLaravelVersion(['5.0'])) |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Register the service provider. |
|
| 106 | - * |
|
| 107 | - * @return void |
|
| 108 | - */ |
|
| 109 | - public function register() |
|
| 110 | - { |
|
| 111 | - $this->registerConfig(); |
|
| 104 | + /** |
|
| 105 | + * Register the service provider. |
|
| 106 | + * |
|
| 107 | + * @return void |
|
| 108 | + */ |
|
| 109 | + public function register() |
|
| 110 | + { |
|
| 111 | + $this->registerConfig(); |
|
| 112 | 112 | $this->registerFieldProvider(); |
| 113 | 113 | $this->registerJsProvider(); |
| 114 | 114 | $this->registerDataCollector(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $this->registerLogger(); |
| 117 | 117 | $this->registerExceptionEncoder(); |
| 118 | 118 | $this->registerEventLoggers(); |
| 119 | - } |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Register config |
@@ -76,8 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | return preg_replace($pattern, $out, $view); |
| 78 | 78 | }); |
| 79 | - } |
|
| 80 | - else |
|
| 79 | + } else |
|
| 81 | 80 | { |
| 82 | 81 | Blade::directive('understandJsConfig', function () |
| 83 | 82 | { |
@@ -319,8 +318,7 @@ discard block |
||
| 319 | 318 | { |
| 320 | 319 | $this->handleEvent($level, $message, $context); |
| 321 | 320 | }); |
| 322 | - } |
|
| 323 | - else |
|
| 321 | + } else |
|
| 324 | 322 | { |
| 325 | 323 | // starting from L5.4 MessageLogged event class was introduced |
| 326 | 324 | // https://github.com/laravel/framework/commit/57c82d095c356a0fe0f9381536afec768cdcc072 |
@@ -348,8 +346,7 @@ discard block |
||
| 348 | 346 | $this->app['understand.tokenProvider']->generate(); |
| 349 | 347 | $this->app['understand.dataCollector']->reset(); |
| 350 | 348 | }); |
| 351 | - } |
|
| 352 | - else |
|
| 349 | + } else |
|
| 353 | 350 | { |
| 354 | 351 | $this->app['events']->listen('Illuminate\Queue\Events\JobProcessing', function() |
| 355 | 352 | { |
@@ -379,8 +376,7 @@ discard block |
||
| 379 | 376 | 'time' => $time, |
| 380 | 377 | ]); |
| 381 | 378 | }); |
| 382 | - } |
|
| 383 | - else |
|
| 379 | + } else |
|
| 384 | 380 | { |
| 385 | 381 | // https://laravel.com/api/5.3/Illuminate/Database/Events/QueryExecuted.html |
| 386 | 382 | $this->app['events']->listen('Illuminate\Database\Events\QueryExecuted', function($event) |
@@ -422,8 +418,7 @@ discard block |
||
| 422 | 418 | unset($context['exception']); |
| 423 | 419 | |
| 424 | 420 | $this->app['understand.exceptionLogger']->logError($level, $exception, $context); |
| 425 | - } |
|
| 426 | - else |
|
| 421 | + } else |
|
| 427 | 422 | { |
| 428 | 423 | $this->app['understand.exceptionLogger']->logError($level, $message, $context); |
| 429 | 424 | } |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // L5.0 does not support custom directives |
| 54 | 54 | if ($this->detectLaravelVersion(['5.0'])) |
| 55 | 55 | { |
| 56 | - Blade::extend(function ($view, $compiler) |
|
| 56 | + Blade::extend(function($view, $compiler) |
|
| 57 | 57 | { |
| 58 | 58 | $configuration = UnderstandJsProvider::getJsConfig(); |
| 59 | 59 | |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | return preg_replace($pattern, json_encode($configuration), $view); |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | - Blade::extend(function ($view, $compiler) |
|
| 65 | + Blade::extend(function($view, $compiler) |
|
| 66 | 66 | { |
| 67 | 67 | $configuration = UnderstandJsProvider::getJsConfig(); |
| 68 | 68 | |
| 69 | 69 | $pattern = $compiler->createMatcher('understandJs'); |
| 70 | 70 | |
| 71 | - $out = "<script src=\"" . UnderstandJsProvider::getJsBundleUrl() . "\"></script>\r\n"; |
|
| 71 | + $out = "<script src=\"".UnderstandJsProvider::getJsBundleUrl()."\"></script>\r\n"; |
|
| 72 | 72 | $out .= "<script>\r\n"; |
| 73 | - $out .= "Understand.init(" . json_encode($configuration) . ");\r\n"; |
|
| 73 | + $out .= "Understand.init(".json_encode($configuration).");\r\n"; |
|
| 74 | 74 | $out .= "Understand.catchErrors();\r\n"; |
| 75 | 75 | $out .= "</script>"; |
| 76 | 76 | |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | else |
| 81 | 81 | { |
| 82 | - Blade::directive('understandJsConfig', function () |
|
| 82 | + Blade::directive('understandJsConfig', function() |
|
| 83 | 83 | { |
| 84 | 84 | $configuration = UnderstandJsProvider::getJsConfig(); |
| 85 | 85 | |
| 86 | 86 | return json_encode($configuration); |
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | - Blade::directive('understandJs', function () |
|
| 89 | + Blade::directive('understandJs', function() |
|
| 90 | 90 | { |
| 91 | 91 | $configuration = UnderstandJsProvider::getJsConfig(); |
| 92 | 92 | |
| 93 | - $out = "<script src=\"" . UnderstandJsProvider::getJsBundleUrl() . "\"></script>\r\n"; |
|
| 93 | + $out = "<script src=\"".UnderstandJsProvider::getJsBundleUrl()."\"></script>\r\n"; |
|
| 94 | 94 | $out .= "<script>\r\n"; |
| 95 | - $out .= "Understand.init(" . json_encode($configuration) . ");\r\n"; |
|
| 95 | + $out .= "Understand.init(".json_encode($configuration).");\r\n"; |
|
| 96 | 96 | $out .= "Understand.catchErrors();\r\n"; |
| 97 | 97 | $out .= "</script>"; |
| 98 | 98 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | protected function registerConfig() |
| 127 | 127 | { |
| 128 | - $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
|
| 128 | + $configPath = __DIR__.'/../../config/understand-laravel.php'; |
|
| 129 | 129 | $this->mergeConfigFrom($configPath, 'understand-laravel'); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | return new Handlers\SyncHandler($inputToken, $apiUrl, $sslBundlePath); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - throw new \ErrorException('understand-laravel handler misconfiguration:' . $handlerType); |
|
| 294 | + throw new \ErrorException('understand-laravel handler misconfiguration:'.$handlerType); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -410,13 +410,13 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // `\Log::info`, `\Log::debug` and NOT `\Exception` or `\Throwable` |
| 413 | - if (in_array($level, ['info', 'debug']) && ! ($message instanceof Exception || $message instanceof Throwable)) |
|
| 413 | + if (in_array($level, ['info', 'debug']) && !($message instanceof Exception || $message instanceof Throwable)) |
|
| 414 | 414 | { |
| 415 | 415 | $this->app['understand.eventLogger']->logEvent($level, $message, $context); |
| 416 | 416 | } |
| 417 | 417 | // `\Log::notice`, `\Log::warning`, `\Log::error`, `\Log::critical`, `\Log::alert`, `\Log::emergency` and `\Exception`, `\Throwable` |
| 418 | 418 | // '5.5', '5.6', '5.7', '5.8' |
| 419 | - 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)) |
|
| 419 | + 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)) |
|
| 420 | 420 | { |
| 421 | 421 | $exception = $context['exception']; |
| 422 | 422 | unset($context['exception']); |
@@ -437,9 +437,9 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | protected function shouldIgnoreEvent($level, $message, $context) |
| 439 | 439 | { |
| 440 | - $ignoredEventTypes = (array)$this->app['config']->get('understand-laravel.ignored_logs'); |
|
| 440 | + $ignoredEventTypes = (array) $this->app['config']->get('understand-laravel.ignored_logs'); |
|
| 441 | 441 | |
| 442 | - if ( ! $ignoredEventTypes) |
|
| 442 | + if (!$ignoredEventTypes) |
|
| 443 | 443 | { |
| 444 | 444 | return false; |
| 445 | 445 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function getJsBundleUrl() |
| 33 | 33 | { |
| 34 | - return $this->app['config']->get('understand-laravel.cdn', 'https://cdn.understand.io/understand-js/' . self::DEFAULT_BUNDLE_VERSION . '/bundle.min.js'); |
|
| 34 | + return $this->app['config']->get('understand-laravel.cdn', 'https://cdn.understand.io/understand-js/'.self::DEFAULT_BUNDLE_VERSION.'/bundle.min.js'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |