1 | <?php |
||
9 | class Aggregator |
||
10 | { |
||
11 | /** |
||
12 | * @var Range[] |
||
13 | */ |
||
14 | private $aggregated = []; |
||
15 | |||
16 | /** |
||
17 | * @var Codepoint|null |
||
18 | */ |
||
19 | private $previous; |
||
20 | |||
21 | /** |
||
22 | * @var Codepoint|null |
||
23 | */ |
||
24 | private $rangeStart; |
||
25 | |||
26 | /** |
||
27 | * @param Codepoint $codepoint |
||
28 | */ |
||
29 | public function addCodepoint(Codepoint $codepoint) |
||
44 | |||
45 | /** |
||
46 | * @return bool |
||
47 | */ |
||
48 | private function hasOpenRange() |
||
52 | |||
53 | /** |
||
54 | * @param Codepoint $codepoint |
||
55 | * @return bool |
||
56 | */ |
||
57 | private function shouldCloseCurrentRangeWith(Codepoint $codepoint) |
||
62 | |||
63 | /** |
||
64 | * @param Codepoint $codepoint |
||
65 | * @return bool |
||
66 | * @throws UnexpectedValueException |
||
67 | */ |
||
68 | private function isPlusOneOfPrevious(Codepoint $codepoint) |
||
76 | |||
77 | /** |
||
78 | * @param Codepoint $codepoint |
||
79 | */ |
||
80 | private function openNewRangeWith(Codepoint $codepoint) |
||
84 | |||
85 | /** |
||
86 | * @param Range $range |
||
87 | */ |
||
88 | private function addRange(Range $range) |
||
92 | |||
93 | private function closeCurrentRange() |
||
98 | |||
99 | /** |
||
100 | * @return Range |
||
101 | * @throws UnexpectedValueException |
||
102 | */ |
||
103 | private function getCurrentRange() |
||
111 | |||
112 | /** |
||
113 | * @return Range[]|Range\Collection |
||
114 | */ |
||
115 | public function getAggregated() |
||
127 | |||
128 | /** |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function hasAggregated() |
||
135 | } |
||
136 |