| Conditions | 1 |
| Paths | 1 |
| Total Lines | 7 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 4 | public static function detectDate(SplFileInfo $file) : DateTimeInterface |
|
| 24 | { |
||
| 25 | 4 | preg_match('/(\d{4})[\/\-]*(\d{2})[\/\-]*(\d{2})[\/\-]*(\d+|)/', $file->getFilename(), $matches); |
|
| 26 | 4 | list($dummy, $year, $month, $day) = $matches; |
|
|
|
|||
| 27 | |||
| 28 | 4 | return new DateTime(implode('-', [$year, $month, $day])); |
|
| 29 | } |
||
| 30 | |||
| 42 |
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.