Total Complexity | 18 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class Mappings |
||
10 | { |
||
11 | public static function conflict(MappingInterface ...$mappings): bool |
||
23 | } |
||
24 | |||
25 | private static function haveConflicts(MappingInterface $subject, MappingInterface $opponent): bool |
||
34 | } |
||
35 | |||
36 | private static function haveTypeConflict(MappingInterface $subject, MappingInterface $opponent): bool |
||
37 | { |
||
38 | return $subject->getType() && $opponent->getType() && $subject->getType() !== $opponent->getType(); |
||
39 | } |
||
40 | |||
41 | private static function haveParameterConflicts(MappingInterface $subject, MappingInterface $opponent): bool |
||
42 | { |
||
43 | foreach ($subject->getParameters() as $parameter => $value) { |
||
44 | if ($opponent->hasParameter($parameter) && $opponent->getParameter($parameter) != $value) { |
||
45 | return true; |
||
46 | } |
||
47 | } |
||
48 | return false; |
||
49 | } |
||
50 | |||
51 | private static function havePropertyConflicts(MappingInterface $subject, MappingInterface $opponent): bool |
||
59 | } |
||
60 | } |
||
61 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: