Completed
Push — master ( a54abf...48ef6d )
by Aivis
01:38
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
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     protected function stackTraceCallToString(array $trace)
260 260
     {
261
-        if (! isset($trace['type']))
261
+        if (!isset($trace['type']))
262 262
         {
263 263
             return 'function';
264 264
         }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
     {
285 285
         $params = [];
286 286
 
287
-        if (! isset($trace['args']))
287
+        if (!isset($trace['args']))
288 288
         {
289 289
             return $params;
290 290
         }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         {
294 294
             if (is_array($arg))
295 295
             {
296
-                $params[] = 'array(' . count($arg) . ')';
296
+                $params[] = 'array('.count($arg).')';
297 297
             }
298 298
             else if (is_object($arg))
299 299
             {
@@ -301,19 +301,19 @@  discard block
 block discarded – undo
301 301
             }
302 302
             else if (is_string($arg))
303 303
             {
304
-                $params[] = 'string(' . (strlen($arg) > 70 ? substr($arg, 0, 70) . '...' : $arg) . ')';
304
+                $params[] = 'string('.(strlen($arg) > 70 ? substr($arg, 0, 70).'...' : $arg).')';
305 305
             }
306 306
             else if (is_int($arg))
307 307
             {
308
-                $params[] = 'int(' . $arg . ')';
308
+                $params[] = 'int('.$arg.')';
309 309
             }
310 310
             else if (is_float($arg))
311 311
             {
312
-                $params[] = 'float(' . $arg . ')';
312
+                $params[] = 'float('.$arg.')';
313 313
             }
314 314
             else if (is_bool($arg))
315 315
             {
316
-                $params[] = 'bool(' . ($arg ? 'true' : 'false') . ')';
316
+                $params[] = 'bool('.($arg ? 'true' : 'false').')';
317 317
             }
318 318
             else if ($arg instanceof \__PHP_Incomplete_Class)
319 319
             {
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(' . (strlen($arg) > 70 ? substr($arg, 0, 70) . '...' : $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.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -301,17 +301,14 @@  discard block
 block discarded – undo
301 301
                 if ($value instanceof \DateTimeInterface)
302 302
                 {
303 303
                     $binding = $value->format('Y-m-d H:i:s');
304
-                }
305
-                elseif (is_bool($value))
304
+                } elseif (is_bool($value))
306 305
                 {
307 306
                     $binding = (int) $value;
308
-                }
309
-                else
307
+                } else
310 308
                 {
311 309
                     $binding = (string)$value;
312 310
                 }
313
-            }
314
-            catch (\Exception $e)
311
+            } catch (\Exception $e)
315 312
             {
316 313
                 $binding = '[handler error]';
317 314
             }
@@ -388,8 +385,7 @@  discard block
 block discarded – undo
388 385
             try
389 386
             {
390 387
                 $queryString[$key] = $this->parseRequestFieldValue($key, $value);
391
-            }
392
-            catch (\Exception $e)
388
+            } catch (\Exception $e)
393 389
             {
394 390
                 $queryString[$key] = '[handler error]';
395 391
             }
@@ -422,12 +418,10 @@  discard block
 block discarded – undo
422 418
         if (method_exists($this->request, 'json') && method_exists($this->request, 'isJson') && $this->request->isJson())
423 419
         {
424 420
             $source = $this->request->json();
425
-        }
426
-        else if ($this->request->request instanceof \IteratorAggregate)
421
+        } else if ($this->request->request instanceof \IteratorAggregate)
427 422
         {
428 423
             $source = $this->request->request;
429
-        }
430
-        else
424
+        } else
431 425
         {
432 426
             return;
433 427
         }
@@ -444,8 +438,7 @@  discard block
 block discarded – undo
444 438
             try
445 439
             {
446 440
                 $postData[$key] = $this->parseRequestFieldValue($key, $value);
447
-            }
448
-            catch (\Exception $e)
441
+            } catch (\Exception $e)
449 442
             {
450 443
                 $postData[$key] = '[handler error]';
451 444
             }
@@ -614,10 +607,8 @@  discard block
 block discarded – undo
614 607
             {
615 608
                 return $userId;
616 609
             }
617
-        }
618
-        catch (\Throwable $e)
619
-        {}
620
-        catch (\Exception $e)
610
+        } catch (\Throwable $e)
611
+        {} catch (\Exception $e)
621 612
         {}
622 613
 
623 614
         try
@@ -626,10 +617,8 @@  discard block
 block discarded – undo
626 617
             {
627 618
                 return $user->id;
628 619
             }
629
-        }
630
-        catch (\Throwable $e)
631
-        {}
632
-        catch (\Exception $e)
620
+        } catch (\Throwable $e)
621
+        {} catch (\Exception $e)
633 622
         {}
634 623
 
635 624
         try
@@ -638,10 +627,8 @@  discard block
 block discarded – undo
638 627
             {
639 628
                 return $user->id;
640 629
             }
641
-        }
642
-        catch (\Throwable $e)
643
-        {}
644
-        catch (\Exception $e)
630
+        } catch (\Throwable $e)
631
+        {} catch (\Exception $e)
645 632
         {}
646 633
     }
647 634
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     protected function getSessionId()
236 236
     {
237
-        if ( ! $this->session)
237
+        if (!$this->session)
238 238
         {
239 239
             return null;
240 240
         }
@@ -260,21 +260,21 @@  discard block
 block discarded – undo
260 260
      */
261 261
     protected function getSqlQueries()
262 262
     {
263
-        if ( ! $this->dataCollector)
263
+        if (!$this->dataCollector)
264 264
         {
265 265
             return [];
266 266
         }
267 267
 
268 268
         $queries = $this->dataCollector->getByKey('sql_queries');
269 269
 
270
-        if ( ! $queries)
270
+        if (!$queries)
271 271
         {
272 272
             return null;
273 273
         }
274 274
 
275 275
         $bindingsEnabled = $this->app['config']->get('understand-laravel.sql_bindings');
276 276
 
277
-        foreach($queries as $key => $queryArray)
277
+        foreach ($queries as $key => $queryArray)
278 278
         {
279 279
             if ($bindingsEnabled)
280 280
             {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         $sqlQuery = $queryArray['query'];
297 297
         $placeholder = '?';
298 298
 
299
-        foreach($queryArray['bindings'] as $key => $value)
299
+        foreach ($queryArray['bindings'] as $key => $value)
300 300
         {
301 301
             try
302 302
             {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                 }
311 311
                 else
312 312
                 {
313
-                    $binding = (string)$value;
313
+                    $binding = (string) $value;
314 314
                 }
315 315
             }
316 316
             catch (\Exception $e)
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      */
337 337
     protected function getRouteName()
338 338
     {
339
-        if ( ! $this->router)
339
+        if (!$this->router)
340 340
         {
341 341
             return null;
342 342
         }
@@ -351,16 +351,16 @@  discard block
 block discarded – undo
351 351
      */
352 352
     protected function getUrl()
353 353
     {
354
-        if ( ! $this->request)
354
+        if (!$this->request)
355 355
         {
356 356
             return null;
357 357
         }
358 358
 
359 359
         $url = $this->request->path();
360 360
 
361
-        if ( ! Str::startsWith($url, '/'))
361
+        if (!Str::startsWith($url, '/'))
362 362
         {
363
-            $url = '/' . $url;
363
+            $url = '/'.$url;
364 364
         }
365 365
 
366 366
         return $url;
@@ -373,19 +373,19 @@  discard block
 block discarded – undo
373 373
     {
374 374
         $enabled = $this->app['config']->get('understand-laravel.query_string_enabled');
375 375
 
376
-        if ( ! $enabled)
376
+        if (!$enabled)
377 377
         {
378 378
             return null;
379 379
         }
380 380
 
381
-        if ( ! $this->request->query instanceof \IteratorAggregate)
381
+        if (!$this->request->query instanceof \IteratorAggregate)
382 382
         {
383 383
             return null;
384 384
         }
385 385
 
386 386
         $queryString = [];
387 387
 
388
-        foreach($this->request->query as $key => $value)
388
+        foreach ($this->request->query as $key => $value)
389 389
         {
390 390
             try
391 391
             {
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     {
408 408
         $enabled = $this->app['config']->get('understand-laravel.post_data_enabled');
409 409
 
410
-        if ( ! $enabled)
410
+        if (!$enabled)
411 411
         {
412 412
             return null;
413 413
         }
@@ -434,14 +434,14 @@  discard block
 block discarded – undo
434 434
             return;
435 435
         }
436 436
 
437
-        if ( ! $source)
437
+        if (!$source)
438 438
         {
439 439
             return;
440 440
         }
441 441
 
442 442
         $postData = [];
443 443
 
444
-        foreach($source as $key => $value)
444
+        foreach ($source as $key => $value)
445 445
         {
446 446
             try
447 447
             {
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
             return get_class($value);
486 486
         }
487 487
 
488
-        return (string)$value;
488
+        return (string) $value;
489 489
     }
490 490
 
491 491
     /**
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      */
496 496
     protected function getRequestMethod()
497 497
     {
498
-        if ( ! $this->request)
498
+        if (!$this->request)
499 499
         {
500 500
             return null;
501 501
         }
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
      */
511 511
     protected function getServerIp()
512 512
     {
513
-        if ( ! $this->request)
513
+        if (!$this->request)
514 514
         {
515 515
             return null;
516 516
         }
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
      */
526 526
     protected function getClientIp()
527 527
     {
528
-        if ( ! $this->request)
528
+        if (!$this->request)
529 529
         {
530 530
             return null;
531 531
         }
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
      */
541 541
     protected function getClientUserAgent()
542 542
     {
543
-        if ( ! $this->request)
543
+        if (!$this->request)
544 544
         {
545 545
             return null;
546 546
         }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
      */
567 567
     protected function getFromSession($key)
568 568
     {
569
-        if ( ! $this->session)
569
+        if (!$this->session)
570 570
         {
571 571
             return null;
572 572
         }
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
     {
585 585
         $parts = [];
586 586
 
587
-        foreach(['class', 'file', 'line', 'code'] as $field)
587
+        foreach (['class', 'file', 'line', 'code'] as $field)
588 588
         {
589 589
             // only include `code` if it's not null value
590 590
             // the `code` attribute of the exception object is useful to differentiate SQL and other exceptions
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
                 continue;
598 598
             }
599 599
 
600
-            $parts[] = isset($log[$field]) ? (string)$log[$field] : null;
600
+            $parts[] = isset($log[$field]) ? (string) $log[$field] : null;
601 601
         }
602 602
 
603 603
         return sha1(implode('#', $parts));
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/Understand/UnderstandLaravel5/UnderstandLaravel5ServiceProvider.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
     /**
216 216
      * Detect Laravel version
217 217
      * 
218
-     * @param array $versions
219
-     * @return type
218
+     * @param string[] $versions
219
+     * @return boolean
220 220
      */
221 221
     protected function detectLaravelVersion(array $versions)
222 222
     {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     }
318 318
 
319 319
     /**
320
-     * @param $level
320
+     * @param string $level
321 321
      * @param $message
322 322
      * @param $context
323 323
      * @return bool
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     /**
338 338
      * Get the services provided by the provider.
339 339
      *
340
-     * @return array
340
+     * @return string[]
341 341
      */
342 342
     public function provides()
343 343
     {
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
116 116
         $this->registerLogger();
117 117
         $this->registerExceptionEncoder();
118 118
         $this->registerEventLoggers();
119
-	}
119
+    }
120 120
 
121 121
     /**
122 122
      * Register config
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
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/JsProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.