@@ -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 | try |
300 | 300 | { |
@@ -308,7 +308,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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,19 +405,19 @@ discard block |
||
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 | } |
412 | 412 | |
413 | - if ( ! $this->request->request instanceof \IteratorAggregate) |
|
413 | + if (!$this->request->request instanceof \IteratorAggregate) |
|
414 | 414 | { |
415 | 415 | return null; |
416 | 416 | } |
417 | 417 | |
418 | 418 | $postData = []; |
419 | 419 | |
420 | - foreach($this->request->request as $key => $value) |
|
420 | + foreach ($this->request->request as $key => $value) |
|
421 | 421 | { |
422 | 422 | try |
423 | 423 | { |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | return get_class($value); |
462 | 462 | } |
463 | 463 | |
464 | - return (string)$value; |
|
464 | + return (string) $value; |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | */ |
472 | 472 | protected function getRequestMethod() |
473 | 473 | { |
474 | - if ( ! $this->request) |
|
474 | + if (!$this->request) |
|
475 | 475 | { |
476 | 476 | return null; |
477 | 477 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | */ |
487 | 487 | protected function getServerIp() |
488 | 488 | { |
489 | - if ( ! $this->request) |
|
489 | + if (!$this->request) |
|
490 | 490 | { |
491 | 491 | return null; |
492 | 492 | } |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | protected function getClientIp() |
503 | 503 | { |
504 | - if ( ! $this->request) |
|
504 | + if (!$this->request) |
|
505 | 505 | { |
506 | 506 | return null; |
507 | 507 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | */ |
517 | 517 | protected function getClientUserAgent() |
518 | 518 | { |
519 | - if ( ! $this->request) |
|
519 | + if (!$this->request) |
|
520 | 520 | { |
521 | 521 | return null; |
522 | 522 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | */ |
543 | 543 | protected function getFromSession($key) |
544 | 544 | { |
545 | - if ( ! $this->session) |
|
545 | + if (!$this->session) |
|
546 | 546 | { |
547 | 547 | return null; |
548 | 548 | } |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | { |
561 | 561 | $parts = []; |
562 | 562 | |
563 | - foreach(['class', 'file', 'line', 'code'] as $field) |
|
563 | + foreach (['class', 'file', 'line', 'code'] as $field) |
|
564 | 564 | { |
565 | 565 | // only include `code` if it's not null value |
566 | 566 | // the `code` attribute of the exception object is useful to differentiate SQL and other exceptions |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | continue; |
574 | 574 | } |
575 | 575 | |
576 | - $parts[] = isset($log[$field]) ? (string)$log[$field] : null; |
|
576 | + $parts[] = isset($log[$field]) ? (string) $log[$field] : null; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | return sha1(implode('#', $parts)); |
@@ -301,17 +301,14 @@ discard block |
||
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 |
||
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,8 +418,7 @@ discard block |
||
422 | 418 | try |
423 | 419 | { |
424 | 420 | $postData[$key] = $this->parseRequestFieldValue($key, $value); |
425 | - } |
|
426 | - catch (\Exception $e) |
|
421 | + } catch (\Exception $e) |
|
427 | 422 | { |
428 | 423 | $postData[$key] = '[handler error]'; |
429 | 424 | } |
@@ -592,10 +587,8 @@ discard block |
||
592 | 587 | { |
593 | 588 | return $userId; |
594 | 589 | } |
595 | - } |
|
596 | - catch (\Throwable $e) |
|
597 | - {} |
|
598 | - catch (\Exception $e) |
|
590 | + } catch (\Throwable $e) |
|
591 | + {} catch (\Exception $e) |
|
599 | 592 | {} |
600 | 593 | |
601 | 594 | try |
@@ -604,10 +597,8 @@ discard block |
||
604 | 597 | { |
605 | 598 | return $user->id; |
606 | 599 | } |
607 | - } |
|
608 | - catch (\Throwable $e) |
|
609 | - {} |
|
610 | - catch (\Exception $e) |
|
600 | + } catch (\Throwable $e) |
|
601 | + {} catch (\Exception $e) |
|
611 | 602 | {} |
612 | 603 | |
613 | 604 | try |
@@ -616,10 +607,8 @@ discard block |
||
616 | 607 | { |
617 | 608 | return $user->id; |
618 | 609 | } |
619 | - } |
|
620 | - catch (\Throwable $e) |
|
621 | - {} |
|
622 | - catch (\Exception $e) |
|
610 | + } catch (\Throwable $e) |
|
611 | + {} catch (\Exception $e) |
|
623 | 612 | {} |
624 | 613 | } |
625 | 614 |