Total Complexity | 3 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | final class MethodRemoved implements ClassBased |
||
14 | { |
||
15 | public function compare(ReflectionClass $fromClass, ReflectionClass $toClass) : Changes |
||
16 | { |
||
17 | Assert::that($fromClass->getName())->same($toClass->getName()); |
||
18 | |||
19 | $removedMethods = array_diff_key( |
||
20 | array_change_key_case($this->accessibleMethods($fromClass), \CASE_UPPER), |
||
21 | array_change_key_case($this->accessibleMethods($toClass), \CASE_UPPER) |
||
22 | ); |
||
23 | |||
24 | return Changes::fromArray(array_values(array_map(function (ReflectionMethod $method) use ($fromClass) : Change { |
||
25 | return Change::removed( |
||
26 | sprintf('Method %s#%s() was removed', $fromClass->getName(), $method->getName()), |
||
27 | true |
||
28 | ); |
||
29 | }, $removedMethods))); |
||
30 | } |
||
31 | |||
32 | /** @return ReflectionMethod[] */ |
||
33 | private function accessibleMethods(ReflectionClass $class) : array |
||
44 | ); |
||
45 | } |
||
46 | } |