@@ -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 |
@@ -258,7 +258,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | { |
@@ -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(' . (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 | } |