1 | <?php |
||
19 | final class Delimiter |
||
20 | { |
||
21 | /** @var string */ |
||
22 | private $char; |
||
23 | |||
24 | /** @var int */ |
||
25 | private $length; |
||
26 | |||
27 | /** @var int */ |
||
28 | private $originalLength; |
||
29 | |||
30 | /** @var AbstractStringContainer */ |
||
31 | private $inlineNode; |
||
32 | |||
33 | /** @var Delimiter|null */ |
||
34 | private $previous; |
||
35 | |||
36 | /** @var Delimiter|null */ |
||
37 | private $next; |
||
38 | |||
39 | /** @var bool */ |
||
40 | private $canOpen; |
||
41 | |||
42 | /** @var bool */ |
||
43 | private $canClose; |
||
44 | |||
45 | /** @var bool */ |
||
46 | private $active; |
||
47 | |||
48 | /** @var int|null */ |
||
49 | private $index; |
||
50 | |||
51 | /** |
||
52 | * @param string $char |
||
53 | * @param int $numDelims |
||
54 | * @param AbstractStringContainer $node |
||
55 | * @param bool $canOpen |
||
56 | * @param bool $canClose |
||
57 | * @param int|null $index |
||
58 | */ |
||
59 | 1020 | public function __construct(string $char, int $numDelims, AbstractStringContainer $node, bool $canOpen, bool $canClose, ?int $index = null) |
|
70 | |||
71 | /** |
||
72 | * @return bool |
||
73 | */ |
||
74 | 924 | public function canClose(): bool |
|
78 | |||
79 | /** |
||
80 | * @param bool $canClose |
||
81 | * |
||
82 | * @return $this |
||
83 | */ |
||
84 | 3 | public function setCanClose(bool $canClose) |
|
85 | { |
||
86 | 3 | $this->canClose = $canClose; |
|
87 | |||
88 | 3 | return $this; |
|
89 | } |
||
90 | |||
91 | /** |
||
92 | * @return bool |
||
93 | */ |
||
94 | 501 | public function canOpen(): bool |
|
98 | |||
99 | /** |
||
100 | * @param bool $canOpen |
||
101 | * |
||
102 | * @return $this |
||
103 | */ |
||
104 | 3 | public function setCanOpen(bool $canOpen) |
|
105 | { |
||
106 | 3 | $this->canOpen = $canOpen; |
|
107 | |||
108 | 3 | return $this; |
|
109 | } |
||
110 | |||
111 | /** |
||
112 | * @return bool |
||
113 | */ |
||
114 | 426 | public function isActive(): bool |
|
118 | |||
119 | /** |
||
120 | * @param bool $active |
||
121 | * |
||
122 | * @return $this |
||
123 | */ |
||
124 | 27 | public function setActive(bool $active) |
|
130 | |||
131 | /** |
||
132 | * @return string |
||
133 | */ |
||
134 | 996 | public function getChar(): string |
|
138 | |||
139 | /** |
||
140 | * @param string $char |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | 3 | public function setChar(string $char) |
|
145 | { |
||
146 | 3 | $this->char = $char; |
|
147 | |||
148 | 3 | return $this; |
|
149 | } |
||
150 | |||
151 | /** |
||
152 | * @return int|null |
||
153 | */ |
||
154 | 291 | public function getIndex(): ?int |
|
158 | |||
159 | /** |
||
160 | * @param int|null $index |
||
161 | * |
||
162 | * @return $this |
||
163 | */ |
||
164 | 3 | public function setIndex(?int $index) |
|
165 | { |
||
166 | 3 | $this->index = $index; |
|
167 | |||
168 | 3 | return $this; |
|
169 | } |
||
170 | |||
171 | /** |
||
172 | * @return Delimiter|null |
||
173 | */ |
||
174 | 993 | public function getNext(): ?self |
|
178 | |||
179 | /** |
||
180 | * @param Delimiter|null $next |
||
181 | * |
||
182 | * @return $this |
||
183 | */ |
||
184 | 600 | public function setNext(?self $next) |
|
190 | |||
191 | /** |
||
192 | * @return int |
||
193 | */ |
||
194 | 420 | public function getLength(): int |
|
195 | { |
||
196 | 420 | return $this->length; |
|
197 | } |
||
198 | |||
199 | /** |
||
200 | * @param int $length |
||
201 | * |
||
202 | * @return $this |
||
203 | */ |
||
204 | 417 | public function setLength(int $length) |
|
205 | { |
||
206 | 417 | $this->length = $length; |
|
207 | |||
208 | 417 | return $this; |
|
209 | } |
||
210 | |||
211 | /** |
||
212 | * @return int |
||
213 | */ |
||
214 | 66 | public function getOriginalLength(): int |
|
215 | { |
||
216 | 66 | return $this->originalLength; |
|
217 | } |
||
218 | |||
219 | /** |
||
220 | * @return AbstractStringContainer |
||
221 | */ |
||
222 | 717 | public function getInlineNode(): AbstractStringContainer |
|
226 | |||
227 | /** |
||
228 | * @param AbstractStringContainer $node |
||
229 | * |
||
230 | * @return $this |
||
231 | */ |
||
232 | 3 | public function setInlineNode(AbstractStringContainer $node) |
|
233 | { |
||
234 | 3 | $this->inlineNode = $node; |
|
235 | |||
236 | 3 | return $this; |
|
237 | } |
||
238 | |||
239 | /** |
||
240 | * @return Delimiter|null |
||
241 | */ |
||
242 | 993 | public function getPrevious(): ?self |
|
246 | |||
247 | /** |
||
248 | * @param Delimiter|null $previous |
||
249 | * |
||
250 | * @return $this |
||
251 | */ |
||
252 | 993 | public function setPrevious(?self $previous) |
|
258 | } |
||
259 |