Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
27 | 14 | public function evaluate($other, string $description = '', bool $returnResult = false): ?bool |
|
28 | { |
||
29 | 14 | $other = ArrayUtility::toArray($other); |
|
30 | 14 | $set = ArrayUtility::toArray($this->set); |
|
31 | |||
32 | 14 | if (ArrayUtility::isAssociative($other)) { |
|
33 | 5 | $result = \array_diff_assoc($other, $set) === []; |
|
34 | } else { |
||
35 | 9 | $result = transform($other)->diff($set)->toArray() === []; |
|
36 | } |
||
37 | |||
38 | 14 | if (!$returnResult && !$result) { |
|
39 | 1 | $this->fail($other, $description); |
|
40 | } |
||
41 | |||
42 | 13 | return $result; |
|
43 | } |
||
58 |