@@ -157,7 +157,7 @@ discard block |
||
| 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 |
||
| 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 | { |
@@ -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 | { |
@@ -120,8 +120,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | { |
@@ -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 | |
@@ -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,7 +405,7 @@ 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 | } |
@@ -417,14 +417,14 @@ discard block |
||
| 417 | 417 | return null; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - if ( ! $this->request->request instanceof \IteratorAggregate) |
|
| 420 | + if (!$this->request->request instanceof \IteratorAggregate) |
|
| 421 | 421 | { |
| 422 | 422 | return null; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $postData = []; |
| 426 | 426 | |
| 427 | - foreach($this->request->request as $key => $value) |
|
| 427 | + foreach ($this->request->request as $key => $value) |
|
| 428 | 428 | { |
| 429 | 429 | try |
| 430 | 430 | { |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | return get_class($value); |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - return (string)$value; |
|
| 471 | + return (string) $value; |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /** |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | protected function getRequestMethod() |
| 480 | 480 | { |
| 481 | - if ( ! $this->request) |
|
| 481 | + if (!$this->request) |
|
| 482 | 482 | { |
| 483 | 483 | return null; |
| 484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | protected function getServerIp() |
| 495 | 495 | { |
| 496 | - if ( ! $this->request) |
|
| 496 | + if (!$this->request) |
|
| 497 | 497 | { |
| 498 | 498 | return null; |
| 499 | 499 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | */ |
| 509 | 509 | protected function getClientIp() |
| 510 | 510 | { |
| 511 | - if ( ! $this->request) |
|
| 511 | + if (!$this->request) |
|
| 512 | 512 | { |
| 513 | 513 | return null; |
| 514 | 514 | } |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | */ |
| 524 | 524 | protected function getClientUserAgent() |
| 525 | 525 | { |
| 526 | - if ( ! $this->request) |
|
| 526 | + if (!$this->request) |
|
| 527 | 527 | { |
| 528 | 528 | return null; |
| 529 | 529 | } |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | */ |
| 550 | 550 | protected function getFromSession($key) |
| 551 | 551 | { |
| 552 | - if ( ! $this->session) |
|
| 552 | + if (!$this->session) |
|
| 553 | 553 | { |
| 554 | 554 | return null; |
| 555 | 555 | } |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | { |
| 568 | 568 | $parts = []; |
| 569 | 569 | |
| 570 | - foreach(['class', 'file', 'line', 'code'] as $field) |
|
| 570 | + foreach (['class', 'file', 'line', 'code'] as $field) |
|
| 571 | 571 | { |
| 572 | 572 | // only include `code` if it's not null value |
| 573 | 573 | // the `code` attribute of the exception object is useful to differentiate SQL and other exceptions |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | continue; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - $parts[] = isset($log[$field]) ? (string)$log[$field] : null; |
|
| 583 | + $parts[] = isset($log[$field]) ? (string) $log[$field] : null; |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | return sha1(implode('#', $parts)); |
@@ -28,7 +28,6 @@ discard block |
||
| 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 |
||
| 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) |
@@ -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 |
@@ -152,12 +152,10 @@ |
||
| 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 | } |
@@ -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 |
@@ -90,8 +90,7 @@ |
||
| 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); |
@@ -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(); |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | $log = [ |
| 46 | 46 | 'message' => $message |
| 47 | 47 | ]; |
| 48 | - } |
|
| 49 | - else |
|
| 48 | + } else |
|
| 50 | 49 | { |
| 51 | 50 | $log = (array)$message; |
| 52 | 51 | } |
@@ -10,20 +10,20 @@ discard block |
||
| 10 | 10 | class UnderstandLaravel5ServiceProvider extends ServiceProvider |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Indicates if loading of the provider is deferred. |
|
| 15 | - * |
|
| 16 | - * @var bool |
|
| 17 | - */ |
|
| 18 | - protected $defer = false; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Bootstrap the application events. |
|
| 22 | - * |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function boot() |
|
| 26 | - { |
|
| 13 | + /** |
|
| 14 | + * Indicates if loading of the provider is deferred. |
|
| 15 | + * |
|
| 16 | + * @var bool |
|
| 17 | + */ |
|
| 18 | + protected $defer = false; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Bootstrap the application events. |
|
| 22 | + * |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function boot() |
|
| 26 | + { |
|
| 27 | 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'); |
@@ -37,23 +37,23 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $this->listenQueryEvents(); |
| 39 | 39 | } |
| 40 | - } |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Register the service provider. |
|
| 44 | - * |
|
| 45 | - * @return void |
|
| 46 | - */ |
|
| 47 | - public function register() |
|
| 48 | - { |
|
| 49 | - $this->registerConfig(); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Register the service provider. |
|
| 44 | + * |
|
| 45 | + * @return void |
|
| 46 | + */ |
|
| 47 | + public function register() |
|
| 48 | + { |
|
| 49 | + $this->registerConfig(); |
|
| 50 | 50 | $this->registerFieldProvider(); |
| 51 | 51 | $this->registerDataCollector(); |
| 52 | 52 | $this->registerTokenProvider(); |
| 53 | 53 | $this->registerLogger(); |
| 54 | 54 | $this->registerExceptionEncoder(); |
| 55 | 55 | $this->registerEventLoggers(); |
| 56 | - } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * Register config |
@@ -215,8 +215,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | { |
@@ -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 | } |
@@ -237,8 +237,7 @@ discard block |
||
| 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 |
@@ -264,8 +263,7 @@ discard block |
||
| 264 | 263 | { |
| 265 | 264 | $this->app['understand.tokenProvider']->generate(); |
| 266 | 265 | }); |
| 267 | - } |
|
| 268 | - else |
|
| 266 | + } else |
|
| 269 | 267 | { |
| 270 | 268 | $this->app['events']->listen('Illuminate\Queue\Events\JobProcessing', function() |
| 271 | 269 | { |
@@ -294,8 +292,7 @@ discard block |
||
| 294 | 292 | 'time' => $time, |
| 295 | 293 | ]); |
| 296 | 294 | }); |
| 297 | - } |
|
| 298 | - else |
|
| 295 | + } else |
|
| 299 | 296 | { |
| 300 | 297 | // https://laravel.com/api/5.3/Illuminate/Database/Events/QueryExecuted.html |
| 301 | 298 | $this->app['events']->listen('Illuminate\Database\Events\QueryExecuted', function($event) |
@@ -337,8 +334,7 @@ discard block |
||
| 337 | 334 | unset($context['exception']); |
| 338 | 335 | |
| 339 | 336 | $this->app['understand.exceptionLogger']->logError($level, $exception, $context); |
| 340 | - } |
|
| 341 | - else |
|
| 337 | + } else |
|
| 342 | 338 | { |
| 343 | 339 | $this->app['understand.exceptionLogger']->logError($level, $message, $context); |
| 344 | 340 | } |
@@ -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 |