1 | <?php |
||
17 | class MappingTool |
||
18 | { |
||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $removedTypes = []; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private $updatedTypes = []; |
||
28 | |||
29 | /** |
||
30 | * Compares two mappings and returns true if changes detected. |
||
31 | * |
||
32 | * @param array $oldMapping |
||
33 | * @param array $newMapping |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function checkMapping($oldMapping, $newMapping) |
||
64 | |||
65 | /** |
||
66 | * Returns symmetric difference. |
||
67 | * |
||
68 | * @param array $oldMapping |
||
69 | * @param array $newMapping |
||
70 | * |
||
71 | * @return array |
||
72 | */ |
||
73 | public function symDifference($oldMapping, $newMapping) |
||
80 | |||
81 | /** |
||
82 | * Returns type name which has been removed. |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | public function getRemovedTypes() |
||
90 | |||
91 | /** |
||
92 | * Returns type names with new properties which has been updated. |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | public function getUpdatedTypes() |
||
100 | |||
101 | /** |
||
102 | * Recursively computes the difference of arrays. |
||
103 | * |
||
104 | * @param array $compareFrom |
||
105 | * @param array $compareAgainst |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | private function recursiveDiff($compareFrom, $compareAgainst) |
||
139 | |||
140 | /** |
||
141 | * Counts scalar values recursively in array. |
||
142 | * |
||
143 | * @param mixed $array |
||
144 | * |
||
145 | * @return int |
||
146 | */ |
||
147 | private function countRecursiveScalars($array) |
||
165 | } |
||
166 |