| Conditions | 7 |
| Paths | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 7.0283 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function process($files) |
||
| 33 | 1 | { |
|
| 34 | 1 | $result = new Collection(); |
|
| 35 | foreach ($this->handlers as $selector => $handler) { |
||
| 36 | 1 | /* @var $handler Handler */ |
|
| 37 | $selectedFiles = Arr::getBySelector($files, $selector); |
||
| 38 | 1 | ||
| 39 | if (!$selectedFiles || !is_array($selectedFiles) || empty($selectedFiles)) { |
||
|
|
|||
| 40 | continue; |
||
| 41 | } |
||
| 42 | 1 | ||
| 43 | 1 | foreach ($selectedFiles as $path => $file) { |
|
| 44 | 1 | if (is_array($file)) { |
|
| 45 | 1 | $result[$path] = $handler->process($file); |
|
| 46 | 1 | } |
|
| 47 | 1 | } |
|
| 48 | } |
||
| 49 | 1 | ||
| 50 | return $result; |
||
| 51 | } |
||
| 52 | |||
| 65 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.