| Conditions | 3 |
| Paths | 1 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function filter(array $filters): Collection |
||
| 22 | { |
||
| 23 | 12 | $filteredItems = array_filter($this->arguments, function ($item) use ($filters) { |
|
| 24 | 12 | foreach ($filters as $filterKey => $filterValue) { |
|
| 25 | 12 | if (!($item->{$filterKey} == $filterValue)) { |
|
| 26 | 12 | return false; |
|
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | 10 | return true; |
|
| 31 | 12 | }); |
|
| 32 | |||
| 33 | 12 | return new Collection(array_values($filteredItems)); |
|
| 34 | } |
||
| 35 | } |
||
| 36 |