@@ -107,9 +107,9 @@ |
||
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 |
@@ -55,7 +55,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -48,7 +48,7 @@ discard block |
||
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 |
||
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(); |
@@ -42,7 +42,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function boot() |
26 | 26 | { |
27 | - $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
|
27 | + $configPath = __DIR__.'/../../config/understand-laravel.php'; |
|
28 | 28 | $this->publishes([$configPath => config_path('understand-laravel.php')], 'config'); |
29 | 29 | $enabled = $this->app['config']->get('understand-laravel.enabled'); |
30 | 30 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function registerConfig() |
64 | 64 | { |
65 | - $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
|
65 | + $configPath = __DIR__.'/../../config/understand-laravel.php'; |
|
66 | 66 | $this->mergeConfigFrom($configPath, 'understand-laravel'); |
67 | 67 | } |
68 | 68 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | return new Handlers\SyncHandler($inputToken, $apiUrl, $sslBundlePath); |
210 | 210 | } |
211 | 211 | |
212 | - throw new \ErrorException('understand-laravel handler misconfiguration:' . $handlerType); |
|
212 | + throw new \ErrorException('understand-laravel handler misconfiguration:'.$handlerType); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -298,13 +298,13 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | // `\Log::info`, `\Log::debug` and NOT `\Exception` or `\Throwable` |
301 | - if (in_array($level, ['info', 'debug']) && ! ($message instanceof Exception || $message instanceof Throwable)) |
|
301 | + if (in_array($level, ['info', 'debug']) && !($message instanceof Exception || $message instanceof Throwable)) |
|
302 | 302 | { |
303 | 303 | $this->app['understand.eventLogger']->logEvent($level, $message, $context); |
304 | 304 | } |
305 | 305 | // `\Log::notice`, `\Log::warning`, `\Log::error`, `\Log::critical`, `\Log::alert`, `\Log::emergency` and `\Exception`, `\Throwable` |
306 | 306 | // '5.5', '5.6', '5.7', '5.8' |
307 | - 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)) |
|
307 | + 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)) |
|
308 | 308 | { |
309 | 309 | $exception = $context['exception']; |
310 | 310 | unset($context['exception']); |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | */ |
326 | 326 | protected function shouldIgnoreEvent($level, $message, $context) |
327 | 327 | { |
328 | - $ignoredEventTypes = (array)$this->app['config']->get('understand-laravel.ignored_logs'); |
|
328 | + $ignoredEventTypes = (array) $this->app['config']->get('understand-laravel.ignored_logs'); |
|
329 | 329 | |
330 | - if ( ! $ignoredEventTypes) |
|
330 | + if (!$ignoredEventTypes) |
|
331 | 331 | { |
332 | 332 | return false; |
333 | 333 | } |
@@ -23,7 +23,7 @@ |
||
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 |
@@ -232,7 +232,7 @@ discard block |
||
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 |
||
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 |
||
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 | if ($value instanceof \DateTimeInterface) |
300 | 300 | { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | protected function getRouteName() |
329 | 329 | { |
330 | - if ( ! $this->router) |
|
330 | + if (!$this->router) |
|
331 | 331 | { |
332 | 332 | return null; |
333 | 333 | } |
@@ -342,16 +342,16 @@ discard block |
||
342 | 342 | */ |
343 | 343 | protected function getUrl() |
344 | 344 | { |
345 | - if ( ! $this->request) |
|
345 | + if (!$this->request) |
|
346 | 346 | { |
347 | 347 | return null; |
348 | 348 | } |
349 | 349 | |
350 | 350 | $url = $this->request->path(); |
351 | 351 | |
352 | - if ( ! starts_with($url, '/')) |
|
352 | + if (!starts_with($url, '/')) |
|
353 | 353 | { |
354 | - $url = '/' . $url; |
|
354 | + $url = '/'.$url; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | return $url; |
@@ -364,19 +364,19 @@ discard block |
||
364 | 364 | { |
365 | 365 | $enabled = $this->app['config']->get('understand-laravel.query_string_enabled'); |
366 | 366 | |
367 | - if ( ! $enabled) |
|
367 | + if (!$enabled) |
|
368 | 368 | { |
369 | 369 | return null; |
370 | 370 | } |
371 | 371 | |
372 | - if ( ! $this->request->query instanceof \IteratorAggregate) |
|
372 | + if (!$this->request->query instanceof \IteratorAggregate) |
|
373 | 373 | { |
374 | 374 | return null; |
375 | 375 | } |
376 | 376 | |
377 | 377 | $queryString = []; |
378 | 378 | |
379 | - foreach($this->request->query as $key => $value) |
|
379 | + foreach ($this->request->query as $key => $value) |
|
380 | 380 | { |
381 | 381 | try |
382 | 382 | { |
@@ -398,19 +398,19 @@ discard block |
||
398 | 398 | { |
399 | 399 | $enabled = $this->app['config']->get('understand-laravel.post_data_enabled'); |
400 | 400 | |
401 | - if ( ! $enabled) |
|
401 | + if (!$enabled) |
|
402 | 402 | { |
403 | 403 | return null; |
404 | 404 | } |
405 | 405 | |
406 | - if ( ! $this->request->request instanceof \IteratorAggregate) |
|
406 | + if (!$this->request->request instanceof \IteratorAggregate) |
|
407 | 407 | { |
408 | 408 | return null; |
409 | 409 | } |
410 | 410 | |
411 | 411 | $postData = []; |
412 | 412 | |
413 | - foreach($this->request->request as $key => $value) |
|
413 | + foreach ($this->request->request as $key => $value) |
|
414 | 414 | { |
415 | 415 | try |
416 | 416 | { |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | return get_class($value); |
455 | 455 | } |
456 | 456 | |
457 | - return (string)$value; |
|
457 | + return (string) $value; |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | protected function getRequestMethod() |
466 | 466 | { |
467 | - if ( ! $this->request) |
|
467 | + if (!$this->request) |
|
468 | 468 | { |
469 | 469 | return null; |
470 | 470 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | protected function getServerIp() |
481 | 481 | { |
482 | - if ( ! $this->request) |
|
482 | + if (!$this->request) |
|
483 | 483 | { |
484 | 484 | return null; |
485 | 485 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | */ |
495 | 495 | protected function getClientIp() |
496 | 496 | { |
497 | - if ( ! $this->request) |
|
497 | + if (!$this->request) |
|
498 | 498 | { |
499 | 499 | return null; |
500 | 500 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | */ |
510 | 510 | protected function getClientUserAgent() |
511 | 511 | { |
512 | - if ( ! $this->request) |
|
512 | + if (!$this->request) |
|
513 | 513 | { |
514 | 514 | return null; |
515 | 515 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | */ |
536 | 536 | protected function getFromSession($key) |
537 | 537 | { |
538 | - if ( ! $this->session) |
|
538 | + if (!$this->session) |
|
539 | 539 | { |
540 | 540 | return null; |
541 | 541 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | { |
554 | 554 | $parts = []; |
555 | 555 | |
556 | - foreach(['class', 'file', 'line', 'code'] as $field) |
|
556 | + foreach (['class', 'file', 'line', 'code'] as $field) |
|
557 | 557 | { |
558 | 558 | // only include `code` if it's not null value |
559 | 559 | // the `code` attribute of the exception object is useful to differentiate SQL and other exceptions |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | continue; |
567 | 567 | } |
568 | 568 | |
569 | - $parts[] = isset($log[$field]) ? (string)$log[$field] : null; |
|
569 | + $parts[] = isset($log[$field]) ? (string) $log[$field] : null; |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | return sha1(implode('#', $parts)); |