Conditions | 4 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
13 | 5 | public function prepare(mixed $value, bool $includeTraceback, string $tracebackIndent = ''): string |
|
14 | { |
||
15 | 5 | return match (true) { |
|
16 | // Exceptions must be first as they are Stringable |
||
17 | 5 | is_object($value) && is_subclass_of($value, Throwable::class) => $this->getExceptionMessage( |
|
18 | 5 | $value, |
|
19 | 5 | $includeTraceback, |
|
20 | 5 | $tracebackIndent |
|
21 | 5 | ), |
|
22 | 5 | (is_scalar($value) || (is_object($value) && ($value instanceof Stringable))) => (string)$value, |
|
23 | 5 | $value instanceof DateTimeInterface => $value->format('Y-m-d H:i:s T'), |
|
24 | 5 | is_object($value) => '[Instance of ' . $value::class . ']', |
|
25 | 5 | is_array($value) => '[Array ' . json_encode($value, JSON_UNESCAPED_SLASHES) . ']', |
|
26 | 5 | is_null($value) => '[null]', |
|
27 | 5 | default => '[' . get_debug_type($value) . ']', |
|
28 | 5 | }; |
|
51 |