| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 60% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | abstract class AbstractCollectionComparator implements CollectionComparatorInterface |
||
| 8 | { |
||
| 9 | 9 | public function notIn(array $array, array $values): array |
|
| 10 | { |
||
| 11 | 9 | return array_udiff($array, $values, $this->getComparisonFunction()); |
|
| 12 | } |
||
| 13 | |||
| 14 | 9 | public function difference(array $array1, array $array2): array |
|
| 15 | { |
||
| 16 | return [ |
||
| 17 | 9 | ...$this->notIn($array1, $array2), |
|
| 18 | 9 | ...$this->notIn($array2, $array1), |
|
| 19 | ]; |
||
| 20 | } |
||
| 21 | |||
| 22 | 3 | public function intersection($array, $values): array |
|
| 23 | { |
||
| 24 | 3 | return array_uintersect($array, $values, $this->getComparisonFunction()); |
|
| 25 | } |
||
| 26 | |||
| 27 | 6 | public function matches(array $array1, array $array2): bool |
|
| 28 | { |
||
| 29 | 6 | return empty($this->difference($array1, $array2)); |
|
| 30 | } |
||
| 31 | |||
| 32 | protected function stripDuplicates(array $array): array |
||
| 33 | { |
||
| 34 | return array_unique($array, SORT_REGULAR); |
||
| 35 | } |
||
| 36 | |||
| 37 | protected function whatEvenIsThis(array $a, array $b): array |
||
| 48 | } |
||
| 49 | } |
||
| 50 |