Completed
Pull Request — master (#40)
by
unknown
01:24
created
src/Understand/UnderstandLaravel5/UnderstandServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     protected function registerConfig()
13 13
     {
14
-        $configPath = __DIR__ . '/../../config/understand-laravel.php';
14
+        $configPath = __DIR__.'/../../config/understand-laravel.php';
15 15
         $this->mergeConfigFrom($configPath, 'understand-laravel');
16 16
     }
17 17
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     protected function registerTokenProvider()
24 24
     {
25
-        $this->app->singleton('understand.tokenProvider', function ()
25
+        $this->app->singleton('understand.tokenProvider', function()
26 26
         {
27 27
             return new TokenProvider();
28 28
         });
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     protected function registerDataCollector()
37 37
     {
38
-        $this->app->singleton('understand.dataCollector', function ()
38
+        $this->app->singleton('understand.dataCollector', function()
39 39
         {
40 40
             return new DataCollector();
41 41
         });
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     protected function registerExceptionEncoder()
50 50
     {
51
-        $this->app->bind('understand.exceptionEncoder', function ()
51
+        $this->app->bind('understand.exceptionEncoder', function()
52 52
         {
53 53
             return new ExceptionEncoder;
54 54
         });
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             return new Handlers\SyncHandler($inputToken, $apiUrl, $sslBundlePath);
114 114
         }
115 115
 
116
-        throw new \ErrorException('understand-laravel handler misconfiguration:' . $handlerType);
116
+        throw new \ErrorException('understand-laravel handler misconfiguration:'.$handlerType);
117 117
     }
118 118
 
119 119
     /**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     protected function shouldIgnoreEvent($level, $message, $context)
126 126
     {
127
-        $ignoredEventTypes = (array)$this->app['config']->get('understand-laravel.ignored_logs');
127
+        $ignoredEventTypes = (array) $this->app['config']->get('understand-laravel.ignored_logs');
128 128
 
129 129
         if (!$ignoredEventTypes) {
130 130
             return false;
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/FieldProvider.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -266,8 +266,7 @@  discard block
 block discarded – undo
266 266
         {
267 267
             // Laravel
268 268
             return Application::VERSION;
269
-        }
270
-        else
269
+        } else
271 270
         {
272 271
             $re = '/Lumen \((.*)\) \(.*\)/m';
273 272
 
@@ -327,17 +326,14 @@  discard block
 block discarded – undo
327 326
                 if ($value instanceof \DateTimeInterface)
328 327
                 {
329 328
                     $binding = $value->format('Y-m-d H:i:s');
330
-                }
331
-                elseif (is_bool($value))
329
+                } elseif (is_bool($value))
332 330
                 {
333 331
                     $binding = (int) $value;
334
-                }
335
-                else
332
+                } else
336 333
                 {
337 334
                     $binding = (string)$value;
338 335
                 }
339
-            }
340
-            catch (\Exception $e)
336
+            } catch (\Exception $e)
341 337
             {
342 338
                 $binding = '[handler error]';
343 339
             }
@@ -414,8 +410,7 @@  discard block
 block discarded – undo
414 410
             try
415 411
             {
416 412
                 $queryString[$key] = $this->parseRequestFieldValue($key, $value);
417
-            }
418
-            catch (\Exception $e)
413
+            } catch (\Exception $e)
419 414
             {
420 415
                 $queryString[$key] = '[handler error]';
421 416
             }
@@ -448,12 +443,10 @@  discard block
 block discarded – undo
448 443
         if (method_exists($this->request, 'json') && method_exists($this->request, 'isJson') && $this->request->isJson())
449 444
         {
450 445
             $source = $this->request->json();
451
-        }
452
-        else if ($this->request->request instanceof \IteratorAggregate)
446
+        } else if ($this->request->request instanceof \IteratorAggregate)
453 447
         {
454 448
             $source = $this->request->request;
455
-        }
456
-        else
449
+        } else
457 450
         {
458 451
             return;
459 452
         }
@@ -470,8 +463,7 @@  discard block
 block discarded – undo
470 463
             try
471 464
             {
472 465
                 $postData[$key] = $this->parseRequestFieldValue($key, $value);
473
-            }
474
-            catch (\Exception $e)
466
+            } catch (\Exception $e)
475 467
             {
476 468
                 $postData[$key] = '[handler error]';
477 469
             }
@@ -640,10 +632,8 @@  discard block
 block discarded – undo
640 632
             {
641 633
                 return $userId;
642 634
             }
643
-        }
644
-        catch (\Throwable $e)
645
-        {}
646
-        catch (\Exception $e)
635
+        } catch (\Throwable $e)
636
+        {} catch (\Exception $e)
647 637
         {}
648 638
 
649 639
         try
@@ -652,10 +642,8 @@  discard block
 block discarded – undo
652 642
             {
653 643
                 return $user->id;
654 644
             }
655
-        }
656
-        catch (\Throwable $e)
657
-        {}
658
-        catch (\Exception $e)
645
+        } catch (\Throwable $e)
646
+        {} catch (\Exception $e)
659 647
         {}
660 648
 
661 649
         try
@@ -664,10 +652,8 @@  discard block
 block discarded – undo
664 652
             {
665 653
                 return $user->id;
666 654
             }
667
-        }
668
-        catch (\Throwable $e)
669
-        {}
670
-        catch (\Exception $e)
655
+        } catch (\Throwable $e)
656
+        {} catch (\Exception $e)
671 657
         {}
672 658
     }
673 659
 
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/UnderstandLaravel5ServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function boot()
25 25
 	{
26
-        $configPath = __DIR__ . '/../../config/understand-laravel.php';
26
+        $configPath = __DIR__.'/../../config/understand-laravel.php';
27 27
         $this->publishes([$configPath => config_path('understand-laravel.php')], 'config');
28 28
         $enabled = $this->app['config']->get('understand-laravel.enabled');
29 29
 
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
         }
236 236
 
237 237
         // `\Log::info`, `\Log::debug` and NOT `\Exception` or `\Throwable`
238
-        if (in_array($level, ['info', 'debug']) && ! ($message instanceof Exception || $message instanceof Throwable))
238
+        if (in_array($level, ['info', 'debug']) && !($message instanceof Exception || $message instanceof Throwable))
239 239
         {
240 240
             $this->app['understand.eventLogger']->logEvent($level, $message, $context);
241 241
         }
242 242
         // `\Log::notice`, `\Log::warning`, `\Log::error`, `\Log::critical`, `\Log::alert`, `\Log::emergency` and `\Exception`, `\Throwable`
243 243
         // '5.5', '5.6', '5.7', '5.8'
244
-        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))
244
+        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))
245 245
         {
246 246
             $exception = $context['exception'];
247 247
             unset($context['exception']);
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/UnderstandLumenServiceProvider.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             return $fieldProvider;
81 81
         });
82 82
 
83
-        if (! class_exists('UnderstandFieldProvider'))
83
+        if (!class_exists('UnderstandFieldProvider'))
84 84
         {
85 85
             class_alias('Understand\UnderstandLaravel5\Facades\UnderstandFieldProvider', 'UnderstandFieldProvider');
86 86
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         parent::registerEventLoggers();
97 97
 
98
-        if (! class_exists('UnderstandExceptionLogger'))
98
+        if (!class_exists('UnderstandExceptionLogger'))
99 99
         {
100 100
             class_alias('Understand\UnderstandLaravel5\Facades\UnderstandExceptionLogger', 'UnderstandExceptionLogger');
101 101
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     {
111 111
         parent::registerLogger();
112 112
 
113
-        if (! class_exists('UnderstandLogger'))
113
+        if (!class_exists('UnderstandLogger'))
114 114
         {
115 115
             class_alias('Understand\UnderstandLaravel5\Facades\UnderstandLogger', 'UnderstandLogger');
116 116
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
             // the illuminate.log event is raised
159 159
             // by our MonologHandler, not by Lumen
160
-            $this->app['events']->listen('illuminate.log', function ($log)
160
+            $this->app['events']->listen('illuminate.log', function($log)
161 161
             {
162 162
                 $this->handleEvent($log['level'], $log['message'], $log['context']);
163 163
             });
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         else
166 166
         {
167 167
             // starting from Lumen 5.6 MessageLogged event class was introduced
168
-            $this->app['events']->listen('Illuminate\Log\Events\MessageLogged', function ($log)
168
+            $this->app['events']->listen('Illuminate\Log\Events\MessageLogged', function($log)
169 169
             {
170 170
                 $this->handleEvent($log->level, $log->message, $log->context);
171 171
             });
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
         // https://github.com/illuminate/queue/commit/ce2b5518902b1bcb9ef650c41900fc8c6392eb0c
176 176
         if ($this->app->runningInConsole()) {
177 177
             if ($this->detectLumenVersion(['5.0', '5.1'])) {
178
-                $this->app['events']->listen('illuminate.queue.after', function () {
178
+                $this->app['events']->listen('illuminate.queue.after', function() {
179 179
                     $this->app['understand.tokenProvider']->generate();
180 180
                     $this->app['understand.dataCollector']->reset();
181 181
                 });
182 182
 
183
-                $this->app['events']->listen('illuminate.queue.failed', function () {
183
+                $this->app['events']->listen('illuminate.queue.failed', function() {
184 184
                     $this->app['understand.tokenProvider']->generate();
185 185
                     $this->app['understand.dataCollector']->reset();
186 186
                 });
187 187
             } else {
188
-                $this->app['events']->listen('Illuminate\Queue\Events\JobProcessing', function () {
188
+                $this->app['events']->listen('Illuminate\Queue\Events\JobProcessing', function() {
189 189
                     $this->app['understand.tokenProvider']->generate();
190 190
                     $this->app['understand.dataCollector']->reset();
191 191
                 });
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         }
243 243
 
244 244
         // `\Log::info`, `\Log::debug` and NOT `\Exception` or `\Throwable`
245
-        if (in_array($level, ['info', 'debug']) && ! ($message instanceof Exception || $message instanceof Throwable))
245
+        if (in_array($level, ['info', 'debug']) && !($message instanceof Exception || $message instanceof Throwable))
246 246
         {
247 247
             $this->app['understand.eventLogger']->logEvent($level, $message, $context);
248 248
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -161,8 +161,7 @@  discard block
 block discarded – undo
161 161
             {
162 162
                 $this->handleEvent($log['level'], $log['message'], $log['context']);
163 163
             });
164
-        }
165
-        else
164
+        } else
166 165
         {
167 166
             // starting from Lumen 5.6 MessageLogged event class was introduced
168 167
             $this->app['events']->listen('Illuminate\Log\Events\MessageLogged', function ($log)
@@ -211,8 +210,7 @@  discard block
 block discarded – undo
211 210
                     'time' => $time,
212 211
                 ]);
213 212
             });
214
-        }
215
-        else
213
+        } else
216 214
         {
217 215
             // https://laravel.com/api/5.3/Illuminate/Database/Events/QueryExecuted.html
218 216
             $this->app['events']->listen('Illuminate\Database\Events\QueryExecuted', function($event)
@@ -253,8 +251,7 @@  discard block
 block discarded – undo
253 251
             unset($context['exception']);
254 252
 
255 253
             $this->app['understand.exceptionLogger']->logError($level, $exception, $context);
256
-        }
257
-        else
254
+        } else
258 255
         {
259 256
             $this->app['understand.exceptionLogger']->logError($level, $message, $context);
260 257
         }
Please login to merge, or discard this patch.