1 | <?php |
||
29 | final class ReversedComparator extends AbstractComparator |
||
30 | { |
||
31 | /** @var ComparatorInterface */ |
||
32 | private $internalComparator; |
||
33 | |||
34 | /** |
||
35 | * ReversedComparator constructor. |
||
36 | * |
||
37 | * @param ComparatorInterface $internalComparator The comparator to reverse. |
||
38 | */ |
||
39 | 11 | public function __construct(ComparatorInterface $internalComparator) |
|
43 | |||
44 | /** |
||
45 | * Compares two versions with each other using the internal comparator, and returns the opposite result. |
||
46 | * |
||
47 | * @param DeltaInterface $version1 |
||
48 | * @param DeltaInterface $version2 |
||
49 | * |
||
50 | * @return int |
||
51 | */ |
||
52 | 6 | public function compare(DeltaInterface $version1, DeltaInterface $version2) |
|
56 | |||
57 | /** |
||
58 | * Returns a comparator that sorts in the opposite direction. |
||
59 | * |
||
60 | * @return static |
||
61 | */ |
||
62 | public function getReverse() |
||
66 | } |
||
67 |