| Conditions | 6 |
| Paths | 7 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function export() |
||
| 25 | { |
||
| 26 | foreach ($this->messages as $message) { |
||
| 27 | list($text, $level, $category, $timestamp) = $message; |
||
|
|
|||
| 28 | if (!is_string($text)) { |
||
| 29 | // exceptions may not be serializable if in the call stack somewhere is a Closure |
||
| 30 | if ($text instanceof \Throwable || $text instanceof \Exception) { |
||
| 31 | $text = (string) $text; |
||
| 32 | } else { |
||
| 33 | $text = VarDumper::export($text); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | $string = "[$level][$category] $text"; |
||
| 38 | |||
| 39 | if ($level === Logger::LEVEL_ERROR) { |
||
| 40 | Console::stderr($string); |
||
| 41 | } else { |
||
| 42 | Console::stdout($string); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 |
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
$aand$care used. There was no need to assign$b.Instead, the list call could have been.