Conditions | 7 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 7 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 1 | public function __invoke($collection, array $properties, $strict = true) |
|
21 | { |
||
22 | 1 | $filter = new FilterMutator; |
|
23 | |||
24 | 1 | return $filter($collection, function ($item) use ($properties, $strict) { |
|
25 | 1 | foreach ($properties as $key => $value) { |
|
26 | 1 | if (empty($item[$key]) |
|
27 | 1 | || ($strict && $item[$key] !== $value) |
|
28 | 1 | || (!$strict && $item[$key] != $value) |
|
29 | ) { |
||
30 | 1 | return false; |
|
31 | } |
||
32 | } |
||
33 | |||
34 | 1 | return true; |
|
35 | 1 | }); |
|
36 | } |
||
37 | } |
||
38 |