Completed
Pull Request — master (#40)
by
unknown
01:24
created
src/Understand/UnderstandLaravel5/ExceptionEncoder.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     }
158 158
 
159 159
     /**
160
-     * @param $relativePath
160
+     * @param string|null $relativePath
161 161
      * @param $line
162 162
      * @param int $linesAround
163 163
      * @return array|void
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      * Return stack trace file
218 218
      *
219 219
      * @param array $trace
220
-     * @return mixed
220
+     * @return string|null
221 221
      */
222 222
     protected function getStackTraceFile(array $trace)
223 223
     {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function exceptionToArray($exception)
44 44
     {
45
-        if ( ! ($exception instanceof Exception || $exception instanceof Throwable))
45
+        if (!($exception instanceof Exception || $exception instanceof Throwable))
46 46
         {
47 47
             throw new InvalidArgumentException('$exception must be instance of Exception or Throwable');
48 48
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         $stackTrace = $this->getCurrentStackTrace($level);
72 72
         $firstLineSet = false;
73 73
 
74
-        foreach($stackTrace as $trace)
74
+        foreach ($stackTrace as $trace)
75 75
         {
76 76
             if ($firstLineSet)
77 77
             {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $stackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, $this->stackTraceLimit);
99 99
         $vendorExcluded = false;
100 100
 
101
-        foreach($stackTrace as $index => $trace)
101
+        foreach ($stackTrace as $index => $trace)
102 102
         {
103 103
             // exclude Understand service provider and helper classes
104 104
             if (isset($trace['class']) && strpos($trace['class'], 'Understand\UnderstandLaravel5\\') === 0)
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 unset($stackTrace[$index]);
107 107
             }
108 108
 
109
-            if ( ! isset($trace['file']))
109
+            if (!isset($trace['file']))
110 110
             {
111 111
                 $vendorExcluded = true;
112 112
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             }
118 118
 
119 119
             // exclude `vendor` folder until project path reached
120
-            if (strpos($trace['file'], $this->projectRoot . 'vendor' . DIRECTORY_SEPARATOR) === 0)
120
+            if (strpos($trace['file'], $this->projectRoot.'vendor'.DIRECTORY_SEPARATOR) === 0)
121 121
             {
122 122
                 unset($stackTrace[$index]);
123 123
             }
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function getCode($relativePath, $line, $linesAround = 6)
187 187
     {
188
-        if ( ! $relativePath || ! $line)
188
+        if (!$relativePath || !$line)
189 189
         {
190 190
             return;
191 191
         }
192 192
 
193
-        $filePath = $this->projectRoot . $relativePath;
193
+        $filePath = $this->projectRoot.$relativePath;
194 194
 
195 195
         try
196 196
         {
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
             $codeLines = [];
201 201
 
202 202
             $from = max(0, $line - $linesAround - 2);
203
-            $to = min($line + $linesAround -1, $file->key() + 1);
203
+            $to = min($line + $linesAround - 1, $file->key() + 1);
204 204
 
205 205
             $file->seek($from);
206 206
 
207
-            while ($file->key() < $to && ! $file->eof())
207
+            while ($file->key() < $to && !$file->eof())
208 208
             {
209 209
                 $file->next();
210 210
                 // `key()` returns 0 as the first line
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      */
257 257
     protected function stackTraceCallToString(array $trace)
258 258
     {
259
-        if (! isset($trace['type']))
259
+        if (!isset($trace['type']))
260 260
         {
261 261
             return 'function';
262 262
         }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     {
283 283
         $params = [];
284 284
 
285
-        if (! isset($trace['args']))
285
+        if (!isset($trace['args']))
286 286
         {
287 287
             return $params;
288 288
         }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         {
292 292
             if (is_array($arg))
293 293
             {
294
-                $params[] = 'array(' . count($arg) . ')';
294
+                $params[] = 'array('.count($arg).')';
295 295
             }
296 296
             else if (is_object($arg))
297 297
             {
@@ -299,19 +299,19 @@  discard block
 block discarded – undo
299 299
             }
300 300
             else if (is_string($arg))
301 301
             {
302
-                $params[] = 'string(' . $arg . ')';
302
+                $params[] = 'string('.$arg.')';
303 303
             }
304 304
             else if (is_int($arg))
305 305
             {
306
-                $params[] = 'int(' . $arg . ')';
306
+                $params[] = 'int('.$arg.')';
307 307
             }
308 308
             else if (is_float($arg))
309 309
             {
310
-                $params[] = 'float(' . $arg . ')';
310
+                $params[] = 'float('.$arg.')';
311 311
             }
312 312
             else if (is_bool($arg))
313 313
             {
314
-                $params[] = 'bool(' . ($arg ? 'true' : 'false') . ')';
314
+                $params[] = 'bool('.($arg ? 'true' : 'false').')';
315 315
             }
316 316
             else if ($arg instanceof \__PHP_Incomplete_Class)
317 317
             {
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -120,8 +120,7 @@  discard block
 block discarded – undo
120 120
             if (strpos($trace['file'], $this->projectRoot . 'vendor' . DIRECTORY_SEPARATOR) === 0)
121 121
             {
122 122
                 unset($stackTrace[$index]);
123
-            }
124
-            else
123
+            } else
125 124
             {
126 125
                 $vendorExcluded = true;
127 126
             }
@@ -215,10 +214,8 @@  discard block
 block discarded – undo
215 214
             }
216 215
 
217 216
             return $codeLines;
218
-        }
219
-        catch (\Throwable $e)
220
-        {}
221
-        catch (\Exception $e)
217
+        } catch (\Throwable $e)
218
+        {} catch (\Exception $e)
222 219
         {}
223 220
     }
224 221
 
@@ -294,32 +291,25 @@  discard block
 block discarded – undo
294 291
             if (is_array($arg))
295 292
             {
296 293
                 $params[] = 'array(' . count($arg) . ')';
297
-            }
298
-            else if (is_object($arg))
294
+            } else if (is_object($arg))
299 295
             {
300 296
                 $params[] = get_class($arg);
301
-            }
302
-            else if (is_string($arg))
297
+            } else if (is_string($arg))
303 298
             {
304 299
                 $params[] = 'string(' . $arg . ')';
305
-            }
306
-            else if (is_int($arg))
300
+            } else if (is_int($arg))
307 301
             {
308 302
                 $params[] = 'int(' . $arg . ')';
309
-            }
310
-            else if (is_float($arg))
303
+            } else if (is_float($arg))
311 304
             {
312 305
                 $params[] = 'float(' . $arg . ')';
313
-            }
314
-            else if (is_bool($arg))
306
+            } else if (is_bool($arg))
315 307
             {
316 308
                 $params[] = 'bool(' . ($arg ? 'true' : 'false') . ')';
317
-            }
318
-            else if ($arg instanceof \__PHP_Incomplete_Class)
309
+            } else if ($arg instanceof \__PHP_Incomplete_Class)
319 310
             {
320 311
                 $params[] = 'object(__PHP_Incomplete_Class)'; 
321
-            }
322
-            else
312
+            } else
323 313
             {
324 314
                 $params[] = gettype($arg);
325 315
             }
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/FieldProvider.php 3 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     protected $app;
88 88
 
89 89
     /**
90
-     * @return void
90
+     * @return Application
91 91
      */
92 92
     public function __construct()
93 93
     {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     /**
109 109
      * Set session store
110 110
      *
111
-     * @param type $service
111
+     * @param SessionStore $service
112 112
      */
113 113
     public function setSessionStore(SessionStore $service)
114 114
     {
@@ -157,7 +157,6 @@  discard block
 block discarded – undo
157 157
      * Register a custom HTML macro.
158 158
      *
159 159
      * @param string $name
160
-     * @param  mixed  $macro
161 160
      * @return void
162 161
      */
163 162
     public function extend($name, $provider)
@@ -168,7 +167,7 @@  discard block
 block discarded – undo
168 167
     /**
169 168
      * Set token provider
170 169
      *
171
-     * @param UniqueProcessIdentifier $tokenProvider
170
+     * @param TokenProvider $tokenProvider
172 171
      */
173 172
     public function setTokenProvider(TokenProvider $tokenProvider)
174 173
     {
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     protected function getSessionId()
234 234
     {
235
-        if ( ! $this->session)
235
+        if (!$this->session)
236 236
         {
237 237
             return null;
238 238
         }
@@ -258,21 +258,21 @@  discard block
 block discarded – undo
258 258
      */
259 259
     protected function getSqlQueries()
260 260
     {
261
-        if ( ! $this->dataCollector)
261
+        if (!$this->dataCollector)
262 262
         {
263 263
             return [];
264 264
         }
265 265
 
266 266
         $queries = $this->dataCollector->getByKey('sql_queries');
267 267
 
268
-        if ( ! $queries)
268
+        if (!$queries)
269 269
         {
270 270
             return null;
271 271
         }
272 272
 
273 273
         $bindingsEnabled = $this->app['config']->get('understand-laravel.sql_bindings');
274 274
 
275
-        foreach($queries as $key => $queryArray)
275
+        foreach ($queries as $key => $queryArray)
276 276
         {
277 277
             if ($bindingsEnabled)
278 278
             {
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         $sqlQuery = $queryArray['query'];
295 295
         $placeholder = '?';
296 296
 
297
-        foreach($queryArray['bindings'] as $key => $value)
297
+        foreach ($queryArray['bindings'] as $key => $value)
298 298
         {
299 299
             try
300 300
             {
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
                 }
309 309
                 else
310 310
                 {
311
-                    $binding = (string)$value;
311
+                    $binding = (string) $value;
312 312
                 }
313 313
             }
314 314
             catch (\Exception $e)
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      */
335 335
     protected function getRouteName()
336 336
     {
337
-        if ( ! $this->router)
337
+        if (!$this->router)
338 338
         {
339 339
             return null;
340 340
         }
@@ -349,16 +349,16 @@  discard block
 block discarded – undo
349 349
      */
350 350
     protected function getUrl()
351 351
     {
352
-        if ( ! $this->request)
352
+        if (!$this->request)
353 353
         {
354 354
             return null;
355 355
         }
356 356
 
357 357
         $url = $this->request->path();
358 358
 
359
-        if ( ! starts_with($url, '/'))
359
+        if (!starts_with($url, '/'))
360 360
         {
361
-            $url = '/' . $url;
361
+            $url = '/'.$url;
362 362
         }
363 363
 
364 364
         return $url;
@@ -371,19 +371,19 @@  discard block
 block discarded – undo
371 371
     {
372 372
         $enabled = $this->app['config']->get('understand-laravel.query_string_enabled');
373 373
 
374
-        if ( ! $enabled)
374
+        if (!$enabled)
375 375
         {
376 376
             return null;
377 377
         }
378 378
 
379
-        if ( ! $this->request->query instanceof \IteratorAggregate)
379
+        if (!$this->request->query instanceof \IteratorAggregate)
380 380
         {
381 381
             return null;
382 382
         }
383 383
 
384 384
         $queryString = [];
385 385
 
386
-        foreach($this->request->query as $key => $value)
386
+        foreach ($this->request->query as $key => $value)
387 387
         {
388 388
             try
389 389
             {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     {
406 406
         $enabled = $this->app['config']->get('understand-laravel.post_data_enabled');
407 407
 
408
-        if ( ! $enabled)
408
+        if (!$enabled)
409 409
         {
410 410
             return null;
411 411
         }
@@ -432,14 +432,14 @@  discard block
 block discarded – undo
432 432
             return;
433 433
         }
434 434
 
435
-        if ( ! $source)
435
+        if (!$source)
436 436
         {
437 437
             return;
438 438
         }
439 439
 
440 440
         $postData = [];
441 441
 
442
-        foreach($source as $key => $value)
442
+        foreach ($source as $key => $value)
443 443
         {
444 444
             try
445 445
             {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
             return get_class($value);
484 484
         }
485 485
 
486
-        return (string)$value;
486
+        return (string) $value;
487 487
     }
488 488
 
489 489
     /**
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      */
494 494
     protected function getRequestMethod()
495 495
     {
496
-        if ( ! $this->request)
496
+        if (!$this->request)
497 497
         {
498 498
             return null;
499 499
         }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
      */
509 509
     protected function getServerIp()
510 510
     {
511
-        if ( ! $this->request)
511
+        if (!$this->request)
512 512
         {
513 513
             return null;
514 514
         }
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
      */
524 524
     protected function getClientIp()
525 525
     {
526
-        if ( ! $this->request)
526
+        if (!$this->request)
527 527
         {
528 528
             return null;
529 529
         }
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
      */
539 539
     protected function getClientUserAgent()
540 540
     {
541
-        if ( ! $this->request)
541
+        if (!$this->request)
542 542
         {
543 543
             return null;
544 544
         }
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      */
565 565
     protected function getFromSession($key)
566 566
     {
567
-        if ( ! $this->session)
567
+        if (!$this->session)
568 568
         {
569 569
             return null;
570 570
         }
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
     {
583 583
         $parts = [];
584 584
 
585
-        foreach(['class', 'file', 'line', 'code'] as $field)
585
+        foreach (['class', 'file', 'line', 'code'] as $field)
586 586
         {
587 587
             // only include `code` if it's not null value
588 588
             // the `code` attribute of the exception object is useful to differentiate SQL and other exceptions
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 continue;
596 596
             }
597 597
 
598
-            $parts[] = isset($log[$field]) ? (string)$log[$field] : null;
598
+            $parts[] = isset($log[$field]) ? (string) $log[$field] : null;
599 599
         }
600 600
 
601 601
         return sha1(implode('#', $parts));
Please login to merge, or discard this 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/Logger.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,6 @@  discard block
 block discarded – undo
28 28
     /**
29 29
      * @param FieldProvider $fieldProvider
30 30
      * @param BaseHandler $handler
31
-     * @param bool $silent
32 31
      */
33 32
     public function __construct(FieldProvider $fieldProvider, BaseHandler $handler)
34 33
     {
@@ -144,7 +143,6 @@  discard block
 block discarded – undo
144 143
     /**
145 144
      * Send data to storage
146 145
      *
147
-     * @param array $requestData
148 146
      * @return mixed
149 147
      */
150 148
     protected function send(array $event)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,9 +107,9 @@
 block discarded – undo
107 107
      */
108 108
     protected function formatMessage($message)
109 109
     {
110
-        if ( ! is_bool($message))
110
+        if (!is_bool($message))
111 111
         {
112
-            return (string)$message;
112
+            return (string) $message;
113 113
         }
114 114
         
115 115
         // cast boolean values to "1" or "0" strings
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -152,12 +152,10 @@
 block discarded – undo
152 152
         try
153 153
         {
154 154
             return $this->handler->handle($event);
155
-        }
156
-        catch (\Throwable $e)
155
+        } catch (\Throwable $e)
157 156
         {
158 157
             return false;
159
-        }
160
-        catch (\Exception $ex)
158
+        } catch (\Exception $ex)
161 159
         {
162 160
             return false;
163 161
         }
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/ExceptionLogger.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function log($error)
57 57
     {
58
-        if ( ! $this->canHandle($error))
58
+        if (!$this->canHandle($error))
59 59
         {
60 60
             return;
61 61
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function logError($level, $message, $context)
75 75
     {
76
-        if ( ! $this->canHandle($message))
76
+        if (!$this->canHandle($message))
77 77
         {
78 78
             return;
79 79
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         }
94 94
         else
95 95
         {
96
-            $log = (array)$message;
96
+            $log = (array) $message;
97 97
             $log = $this->encoder->setCurrentStackTrace($log);
98 98
         }
99 99
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         if ($context)
103 103
         {
104
-            $log['context'] = (array)$context;
104
+            $log['context'] = (array) $context;
105 105
         }
106 106
 
107 107
         return $this->dispatch($log);
@@ -150,6 +150,6 @@  discard block
 block discarded – undo
150 150
      */
151 151
     protected function canHandle($error)
152 152
     {
153
-        return (bool)$this->config->get('understand-laravel.enabled');
153
+        return (bool) $this->config->get('understand-laravel.enabled');
154 154
     }
155 155
 }
156 156
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,8 +90,7 @@
 block discarded – undo
90 90
             ];
91 91
 
92 92
             $log = $this->encoder->setCurrentStackTrace($log);
93
-        }
94
-        else
93
+        } else
95 94
         {
96 95
             $log = (array)$message;
97 96
             $log = $this->encoder->setCurrentStackTrace($log);
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/EventLogger.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         }
49 49
         else
50 50
         {
51
-            $log = (array)$message;
51
+            $log = (array) $message;
52 52
         }
53 53
 
54 54
         $log['tags'] = ['laravel_log'];
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         if ($context)
58 58
         {
59
-            $log['context'] = (array)$context;
59
+            $log['context'] = (array) $context;
60 60
         }
61 61
 
62 62
         $additionalFields = $this->getMetaFields();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 block discarded – undo
45 45
             $log = [
46 46
                 'message' => $message
47 47
             ];
48
-        }
49
-        else
48
+        } else
50 49
         {
51 50
             $log = (array)$message;
52 51
         }
Please login to merge, or discard this patch.
src/config/understand-laravel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     /**
24 24
      * Project root folder
25 25
      */
26
-    'project_root' => base_path() . DIRECTORY_SEPARATOR,
26
+    'project_root' => base_path().DIRECTORY_SEPARATOR,
27 27
 
28 28
     /**
29 29
      * Collect SQL queries
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/DataCollector.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     }
56 56
 
57 57
     /**
58
-     * @param $key
58
+     * @param string $key
59 59
      * @return mixed
60 60
      */
61 61
     public function getByKey($key)
Please login to merge, or discard this patch.
src/Understand/UnderstandLaravel5/UnderstandLaravel5ServiceProvider.php 4 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -237,8 +237,7 @@  discard block
 block discarded – undo
237 237
             {
238 238
                 $this->handleEvent($level, $message, $context);
239 239
             });
240
-        }
241
-        else
240
+        } else
242 241
         {
243 242
             // starting from L5.4 MessageLogged event class was introduced
244 243
             // https://github.com/laravel/framework/commit/57c82d095c356a0fe0f9381536afec768cdcc072
@@ -266,8 +265,7 @@  discard block
 block discarded – undo
266 265
                     $this->app['understand.tokenProvider']->generate();
267 266
                     $this->app['understand.dataCollector']->reset();
268 267
                 });
269
-            }
270
-            else
268
+            } else
271 269
             {
272 270
                 $this->app['events']->listen('Illuminate\Queue\Events\JobProcessing', function()
273 271
                 {
@@ -297,8 +295,7 @@  discard block
 block discarded – undo
297 295
                     'time' => $time,
298 296
                 ]);
299 297
             });
300
-        }
301
-        else
298
+        } else
302 299
         {
303 300
             // https://laravel.com/api/5.3/Illuminate/Database/Events/QueryExecuted.html
304 301
             $this->app['events']->listen('Illuminate\Database\Events\QueryExecuted', function($event)
@@ -340,8 +337,7 @@  discard block
 block discarded – undo
340 337
             unset($context['exception']);
341 338
 
342 339
             $this->app['understand.exceptionLogger']->logError($level, $exception, $context);
343
-        }
344
-        else
340
+        } else
345 341
         {
346 342
             $this->app['understand.exceptionLogger']->logError($level, $message, $context);
347 343
         }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,8 +122,8 @@
 block discarded – undo
122 122
     /**
123 123
      * Detect Laravel version
124 124
      * 
125
-     * @param array $versions
126
-     * @return type
125
+     * @param string[] $versions
126
+     * @return boolean
127 127
      */
128 128
     protected function detectLaravelVersion(array $versions)
129 129
     {
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@  discard block
 block discarded – undo
9 9
 class UnderstandLaravel5ServiceProvider extends UnderstandServiceProvider
10 10
 {
11 11
 
12
-	/**
13
-	 * Indicates if loading of the provider is deferred.
14
-	 *
15
-	 * @var bool
16
-	 */
17
-	protected $defer = false;
12
+    /**
13
+     * Indicates if loading of the provider is deferred.
14
+     *
15
+     * @var bool
16
+     */
17
+    protected $defer = false;
18 18
 
19
-	/**
20
-	 * Bootstrap the application events.
21
-	 *
22
-	 * @return void
23
-	 */
24
-	public function boot()
25
-	{
19
+    /**
20
+     * Bootstrap the application events.
21
+     *
22
+     * @return void
23
+     */
24
+    public function boot()
25
+    {
26 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');
@@ -36,23 +36,23 @@  discard block
 block discarded – undo
36 36
         {
37 37
             $this->listenQueryEvents();
38 38
         }
39
-	}
39
+    }
40 40
 
41
-	/**
42
-	 * Register the service provider.
43
-	 *
44
-	 * @return void
45
-	 */
46
-	public function register()
47
-	{
48
-		$this->registerConfig();
41
+    /**
42
+     * Register the service provider.
43
+     *
44
+     * @return void
45
+     */
46
+    public function register()
47
+    {
48
+        $this->registerConfig();
49 49
         $this->registerFieldProvider();
50 50
         $this->registerDataCollector();
51 51
         $this->registerTokenProvider();
52 52
         $this->registerLogger();
53 53
         $this->registerExceptionEncoder();
54 54
         $this->registerEventLoggers();
55
-	}
55
+    }
56 56
 
57 57
     /**
58 58
      * Register field provider
Please login to merge, or discard this 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 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,8 +129,8 @@
 block discarded – undo
129 129
     /**
130 130
      * Detect Lumen version
131 131
      *
132
-     * @param array $versions
133
-     * @return type
132
+     * @param string[] $versions
133
+     * @return boolean
134 134
      */
135 135
     protected function detectLumenVersion(array $versions)
136 136
     {
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -3,11 +3,8 @@
 block discarded – undo
3 3
 namespace Understand\UnderstandLaravel5;
4 4
 
5 5
 use Exception;
6
-use Illuminate\Foundation\AliasLoader;
7 6
 use Illuminate\Support\Str;
8 7
 use Understand\UnderstandLaravel5\Handlers\MonologHandler;
9
-use UnderstandMonolog\Handler\UnderstandAsyncHandler;
10
-use UnderstandMonolog\Handler\UnderstandSyncHandler;
11 8
 
12 9
 class UnderstandLumenServiceProvider extends UnderstandServiceProvider
13 10
 {
Please login to merge, or discard this patch.
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.