Conditions | 6 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function export() |
||
17 | { |
||
18 | foreach ($this->messages as $message) { |
||
19 | list($text, $level, $category, $timestamp) = $message; |
||
|
|||
20 | if (!is_string($text)) { |
||
21 | // exceptions may not be serializable if in the call stack somewhere is a Closure |
||
22 | if ($text instanceof \Throwable || $text instanceof \Exception) { |
||
23 | $text = (string)$text; |
||
24 | } else { |
||
25 | $text = VarDumper::export($text); |
||
26 | } |
||
27 | } |
||
28 | |||
29 | $string = "[$level][$category] $text"; |
||
30 | |||
31 | if ($level == Logger::LEVEL_ERROR) { |
||
32 | Console::stderr($string); |
||
33 | } else { |
||
34 | Console::stdout($string); |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 |
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.