Conditions | 5 |
Paths | 8 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5.0144 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 1 | public function format(array $record): string |
|
21 | { |
||
22 | 1 | $vars = parent::format($record); |
|
23 | |||
24 | 1 | $output = $this->format . PHP_EOL; |
|
25 | |||
26 | 1 | foreach ($vars as $var => $value) { |
|
27 | 1 | if (is_array($value)) { |
|
28 | 1 | $output = str_replace("%{$var}%", json_encode($value), $output); |
|
29 | 1 | continue; |
|
30 | } |
||
31 | |||
32 | 1 | if (strpos($output, "%{$var}%") !== false) { |
|
33 | 1 | $output = str_replace("%{$var}%", $value, $output); |
|
34 | } |
||
35 | } |
||
36 | |||
37 | 1 | if ($vars['exception'] !== null) { |
|
38 | $output .= (string) $vars['exception'] . PHP_EOL; |
||
39 | } |
||
40 | |||
41 | 1 | return $output; |
|
42 | } |
||
44 |