| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 28 | 14 | public function evaluate($other, string $description = '', bool $returnResult = false): ?bool |
|
| 29 | { |
||
| 30 | //type cast $other & $this->subset as an array to allow |
||
| 31 | //support in standard array functions. |
||
| 32 | 14 | $other = ArrayUtility::toArray($other); |
|
| 33 | 14 | $set = ArrayUtility::toArray($this->set); |
|
| 34 | |||
| 35 | 14 | if (ArrayUtility::isAssociative($other)) { |
|
| 36 | 5 | $result = \array_diff_assoc($set, $other) === []; |
|
| 37 | } else { |
||
| 38 | 9 | $result = transform($set)->diff($other)->toArray() === []; |
|
| 39 | } |
||
| 40 | |||
| 41 | 14 | if (!$returnResult && !$result) { |
|
| 42 | 1 | $this->fail($other, $description); |
|
| 43 | } |
||
| 44 | |||
| 45 | 13 | return $result; |
|
| 46 | } |
||
| 61 |