@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | ): string { |
| 23 | 23 | $verbosity ??= $this->defaultVerbosity; |
| 24 | 24 | $exceptions = [$exception]; |
| 25 | - while ($exception = $exception->getPrevious()) { |
|
| 25 | + while ($exception = $exception->getPrevious()){ |
|
| 26 | 26 | $exceptions[] = $exception; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $result = []; |
| 32 | 32 | |
| 33 | - foreach ($exceptions as $exception) { |
|
| 33 | + foreach ($exceptions as $exception){ |
|
| 34 | 34 | $row = \sprintf( |
| 35 | 35 | "[%s]\n%s in %s:%s\n", |
| 36 | 36 | $exception::class, |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | $exception->getLine() |
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | - if ($verbosity->value >= Verbosity::DEBUG->value) { |
|
| 42 | + if ($verbosity->value >= Verbosity::DEBUG->value){ |
|
| 43 | 43 | $row .= $this->renderTrace($exception, new Highlighter(new PlainStyle())); |
| 44 | - } elseif ($verbosity->value >= Verbosity::VERBOSE->value) { |
|
| 44 | + } elseif ($verbosity->value >= Verbosity::VERBOSE->value){ |
|
| 45 | 45 | $row .= $this->renderTrace($exception); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -59,47 +59,47 @@ discard block |
||
| 59 | 59 | private function renderTrace(\Throwable $e, Highlighter $h = null): string |
| 60 | 60 | { |
| 61 | 61 | $stacktrace = $this->getStacktrace($e); |
| 62 | - if (empty($stacktrace)) { |
|
| 62 | + if (empty($stacktrace)){ |
|
| 63 | 63 | return ''; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $result = "\nException Trace:\n"; |
| 67 | 67 | |
| 68 | - foreach ($stacktrace as $trace) { |
|
| 69 | - if (isset($trace['type'], $trace['class'])) { |
|
| 68 | + foreach ($stacktrace as $trace){ |
|
| 69 | + if (isset($trace['type'], $trace['class'])){ |
|
| 70 | 70 | $line = \sprintf( |
| 71 | 71 | ' %s%s%s()', |
| 72 | 72 | $trace['class'], |
| 73 | 73 | $trace['type'], |
| 74 | 74 | $trace['function'] |
| 75 | 75 | ); |
| 76 | - } else { |
|
| 76 | + }else{ |
|
| 77 | 77 | $line = $trace['function']; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (isset($trace['file'])) { |
|
| 80 | + if (isset($trace['file'])){ |
|
| 81 | 81 | $line .= \sprintf(' at %s:%s', $trace['file'], $trace['line']); |
| 82 | - } else { |
|
| 82 | + }else{ |
|
| 83 | 83 | $line .= \sprintf(' at %s:%s', 'n/a', 'n/a'); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (\in_array($line, $this->lines, true)) { |
|
| 86 | + if (\in_array($line, $this->lines, true)){ |
|
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $this->lines[] = $line; |
| 91 | 91 | |
| 92 | - $result .= $line . "\n"; |
|
| 92 | + $result .= $line."\n"; |
|
| 93 | 93 | |
| 94 | - if ($h !== null && !empty($trace['file'])) { |
|
| 94 | + if ($h !== null && !empty($trace['file'])){ |
|
| 95 | 95 | $result .= $h->highlightLines( |
| 96 | 96 | \file_get_contents($trace['file']), |
| 97 | 97 | $trace['line'], |
| 98 | 98 | self::SHOW_LINES |
| 99 | - ) . "\n"; |
|
| 99 | + )."\n"; |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - return $result . "\n"; |
|
| 103 | + return $result."\n"; |
|
| 104 | 104 | } |
| 105 | 105 | } |
@@ -22,7 +22,8 @@ discard block |
||
| 22 | 22 | ): string { |
| 23 | 23 | $verbosity ??= $this->defaultVerbosity; |
| 24 | 24 | $exceptions = [$exception]; |
| 25 | - while ($exception = $exception->getPrevious()) { |
|
| 25 | + while ($exception = $exception->getPrevious()) |
|
| 26 | + { |
|
| 26 | 27 | $exceptions[] = $exception; |
| 27 | 28 | } |
| 28 | 29 | |
@@ -30,7 +31,8 @@ discard block |
||
| 30 | 31 | |
| 31 | 32 | $result = []; |
| 32 | 33 | |
| 33 | - foreach ($exceptions as $exception) { |
|
| 34 | + foreach ($exceptions as $exception) |
|
| 35 | + { |
|
| 34 | 36 | $row = \sprintf( |
| 35 | 37 | "[%s]\n%s in %s:%s\n", |
| 36 | 38 | $exception::class, |
@@ -39,9 +41,12 @@ discard block |
||
| 39 | 41 | $exception->getLine() |
| 40 | 42 | ); |
| 41 | 43 | |
| 42 | - if ($verbosity->value >= Verbosity::DEBUG->value) { |
|
| 44 | + if ($verbosity->value >= Verbosity::DEBUG->value) |
|
| 45 | + { |
|
| 43 | 46 | $row .= $this->renderTrace($exception, new Highlighter(new PlainStyle())); |
| 44 | - } elseif ($verbosity->value >= Verbosity::VERBOSE->value) { |
|
| 47 | + } |
|
| 48 | + elseif ($verbosity->value >= Verbosity::VERBOSE->value) |
|
| 49 | + { |
|
| 45 | 50 | $row .= $this->renderTrace($exception); |
| 46 | 51 | } |
| 47 | 52 | |
@@ -59,31 +64,40 @@ discard block |
||
| 59 | 64 | private function renderTrace(\Throwable $e, Highlighter $h = null): string |
| 60 | 65 | { |
| 61 | 66 | $stacktrace = $this->getStacktrace($e); |
| 62 | - if (empty($stacktrace)) { |
|
| 67 | + if (empty($stacktrace)) |
|
| 68 | + { |
|
| 63 | 69 | return ''; |
| 64 | 70 | } |
| 65 | 71 | |
| 66 | 72 | $result = "\nException Trace:\n"; |
| 67 | 73 | |
| 68 | - foreach ($stacktrace as $trace) { |
|
| 69 | - if (isset($trace['type'], $trace['class'])) { |
|
| 74 | + foreach ($stacktrace as $trace) |
|
| 75 | + { |
|
| 76 | + if (isset($trace['type'], $trace['class'])) |
|
| 77 | + { |
|
| 70 | 78 | $line = \sprintf( |
| 71 | 79 | ' %s%s%s()', |
| 72 | 80 | $trace['class'], |
| 73 | 81 | $trace['type'], |
| 74 | 82 | $trace['function'] |
| 75 | 83 | ); |
| 76 | - } else { |
|
| 84 | + } |
|
| 85 | + else |
|
| 86 | + { |
|
| 77 | 87 | $line = $trace['function']; |
| 78 | 88 | } |
| 79 | 89 | |
| 80 | - if (isset($trace['file'])) { |
|
| 90 | + if (isset($trace['file'])) |
|
| 91 | + { |
|
| 81 | 92 | $line .= \sprintf(' at %s:%s', $trace['file'], $trace['line']); |
| 82 | - } else { |
|
| 93 | + } |
|
| 94 | + else |
|
| 95 | + { |
|
| 83 | 96 | $line .= \sprintf(' at %s:%s', 'n/a', 'n/a'); |
| 84 | 97 | } |
| 85 | 98 | |
| 86 | - if (\in_array($line, $this->lines, true)) { |
|
| 99 | + if (\in_array($line, $this->lines, true)) |
|
| 100 | + { |
|
| 87 | 101 | continue; |
| 88 | 102 | } |
| 89 | 103 | |
@@ -91,7 +105,8 @@ discard block |
||
| 91 | 105 | |
| 92 | 106 | $result .= $line . "\n"; |
| 93 | 107 | |
| 94 | - if ($h !== null && !empty($trace['file'])) { |
|
| 108 | + if ($h !== null && !empty($trace['file'])) |
|
| 109 | + { |
|
| 95 | 110 | $result .= $h->highlightLines( |
| 96 | 111 | \file_get_contents($trace['file']), |
| 97 | 112 | $trace['line'], |