@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function __construct(StringStream $stream, string $type) |
89 | 89 | { |
90 | - if (! self::isKnownType($type)) { |
|
90 | + if (!self::isKnownType($type)) { |
|
91 | 91 | throw new SyntaxErrorException($stream); |
92 | 92 | } |
93 | 93 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function defaultExtractor(string $tokenName) |
125 | 125 | { |
126 | - if($this->multiLineOpened) { |
|
126 | + if ($this->multiLineOpened) { |
|
127 | 127 | $this->stream->ignoreWhitespace(); |
128 | 128 | } else { |
129 | 129 | $this->stream->ignoreHorizontalSpace(); |
@@ -139,27 +139,27 @@ discard block |
||
139 | 139 | |
140 | 140 | $ord = $this->stream->ord(); |
141 | 141 | |
142 | - if($ord == AsciiChar::NULL) { |
|
142 | + if ($ord == AsciiChar::NULL) { |
|
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | - if($ord === AsciiChar::OPEN_BRACKET && !$this->commentOpen) { |
|
146 | + if ($ord === AsciiChar::OPEN_BRACKET && !$this->commentOpen) { |
|
147 | 147 | $this->multiLineOpened = true; |
148 | 148 | $this->stream->next(); |
149 | 149 | goto start; |
150 | - } elseif($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::CLOSE_BRACKET) { |
|
150 | + } elseif ($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::CLOSE_BRACKET) { |
|
151 | 151 | $this->multiLineOpened = false; |
152 | 152 | $this->stream->next(); |
153 | 153 | goto start; |
154 | - } elseif($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::LINE_FEED) { |
|
154 | + } elseif ($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::LINE_FEED) { |
|
155 | 155 | $this->stream->next(); |
156 | 156 | goto start; |
157 | - } elseif($ord === AsciiChar::LINE_FEED && !$this->commentOpen) { |
|
157 | + } elseif ($ord === AsciiChar::LINE_FEED && !$this->commentOpen) { |
|
158 | 158 | return; |
159 | 159 | } else { |
160 | - if($ord === AsciiChar::SEMICOLON) { |
|
160 | + if ($ord === AsciiChar::SEMICOLON) { |
|
161 | 161 | $this->stream->previous(); |
162 | - if($this->stream->currentAscii()->isHorizontalSpace()) { |
|
162 | + if ($this->stream->currentAscii()->isHorizontalSpace()) { |
|
163 | 163 | |
164 | 164 | $this->commentOpen = true; |
165 | 165 | $this->stream->next(); |
@@ -170,19 +170,19 @@ discard block |
||
170 | 170 | $this->stream->next(); |
171 | 171 | } |
172 | 172 | goto start; |
173 | - } elseif(($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
173 | + } elseif (($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
174 | 174 | $this->stream->next(); |
175 | 175 | $this->commentOpen = false; |
176 | 176 | goto start; |
177 | - } elseif($this->commentOpen) { |
|
177 | + } elseif ($this->commentOpen) { |
|
178 | 178 | $this->commentOpen = true; |
179 | 179 | $this->stream->next(); |
180 | 180 | goto start; |
181 | - } elseif(!$this->commentOpen) { |
|
182 | - if($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === "") { |
|
181 | + } elseif (!$this->commentOpen) { |
|
182 | + if ($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === "") { |
|
183 | 183 | $this->stream->next(); |
184 | 184 | goto start; |
185 | - } elseif($this->stream->currentAscii()->isHorizontalSpace()) { |
|
185 | + } elseif ($this->stream->currentAscii()->isHorizontalSpace()) { |
|
186 | 186 | return; |
187 | 187 | } else { |
188 | 188 | $this->tokens[$tokenName] .= $this->stream->current(); |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | { |
198 | 198 | start: |
199 | 199 | $ord = $this->stream->ord(); |
200 | - if($ord == AsciiChar::NULL) { |
|
200 | + if ($ord == AsciiChar::NULL) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | - if($ord === AsciiChar::SEMICOLON) { |
|
203 | + if ($ord === AsciiChar::SEMICOLON) { |
|
204 | 204 | $this->stream->next(); |
205 | 205 | $this->commentOpen = true; |
206 | 206 | goto start; |
207 | - } elseif($this->commentOpen) { |
|
208 | - if($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
207 | + } elseif ($this->commentOpen) { |
|
208 | + if ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
209 | 209 | $this->commentOpen = false; |
210 | 210 | goto start; |
211 | 211 | } else { |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | $this->commentOpen = true; |
214 | 214 | goto start; |
215 | 215 | } |
216 | - } elseif(!$this->commentOpen) { |
|
217 | - if($this->multiLineOpened) { |
|
218 | - if($ord === AsciiChar::CLOSE_BRACKET) { |
|
216 | + } elseif (!$this->commentOpen) { |
|
217 | + if ($this->multiLineOpened) { |
|
218 | + if ($ord === AsciiChar::CLOSE_BRACKET) { |
|
219 | 219 | $this->multiLineOpened = false; |
220 | 220 | } |
221 | 221 | $this->stream->next(); |
222 | 222 | goto start; |
223 | - } elseif($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
223 | + } elseif ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | } |
@@ -239,53 +239,53 @@ discard block |
||
239 | 239 | $ord = $this->stream->ord(); |
240 | 240 | $this->stream->next(); |
241 | 241 | |
242 | - if($ord == 0) { // if end of record |
|
242 | + if ($ord == 0) { // if end of record |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | |
246 | 246 | // comment starts |
247 | - if($ord === 59) { |
|
247 | + if ($ord === 59) { |
|
248 | 248 | $this->commentOpen = true; |
249 | 249 | goto start; |
250 | - } elseif($this->commentOpen == true && $ord !== 10) { |
|
250 | + } elseif ($this->commentOpen == true && $ord !== 10) { |
|
251 | 251 | $this->commentOpen = true; |
252 | 252 | goto start; |
253 | - } elseif($this->commentOpen == true && ($ord === 10 || $ord === 0)) { |
|
253 | + } elseif ($this->commentOpen == true && ($ord === 10 || $ord === 0)) { |
|
254 | 254 | $this->stream->previous(); |
255 | 255 | $this->commentOpen = false; |
256 | 256 | goto start; |
257 | 257 | } else { |
258 | 258 | // ignore blanck line |
259 | - if($ord === 32) { |
|
259 | + if ($ord === 32) { |
|
260 | 260 | goto start; |
261 | 261 | } |
262 | 262 | |
263 | 263 | // Find starts of char set |
264 | - if($ord === 34 && !$this->commentOpen) { // " |
|
264 | + if ($ord === 34 && !$this->commentOpen) { // " |
|
265 | 265 | $this->extractCharSet($tokenName); |
266 | 266 | } |
267 | 267 | |
268 | 268 | // multi line opened |
269 | - if($ord === 40 && !$this->commentOpen) { |
|
269 | + if ($ord === 40 && !$this->commentOpen) { |
|
270 | 270 | $this->multiLineOpened = true; |
271 | 271 | goto start; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // multi line closed |
275 | - if($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
275 | + if ($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
276 | 276 | $this->multiLineOpened = false; |
277 | 277 | goto start; |
278 | 278 | } |
279 | 279 | |
280 | 280 | // comment end in multi line TXT record |
281 | - if($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
281 | + if ($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
282 | 282 | goto start; |
283 | 283 | } |
284 | 284 | |
285 | 285 | // is record ends? |
286 | - if(!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
286 | + if (!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
287 | 287 | return; |
288 | - } elseif($this->multiLineOpened && $ord === 10) { |
|
288 | + } elseif ($this->multiLineOpened && $ord === 10) { |
|
289 | 289 | goto start; |
290 | 290 | } |
291 | 291 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | $ord = $this->stream->ord(); |
302 | 302 | $this->stream->next(); |
303 | 303 | |
304 | - if($ord == 0) { // if end of record |
|
304 | + if ($ord == 0) { // if end of record |
|
305 | 305 | return; |
306 | 306 | } |
307 | 307 | |
308 | - if(!$escaping_open && $ord === 34) { |
|
308 | + if (!$escaping_open && $ord === 34) { |
|
309 | 309 | $this->txtExtractor($tokenName); |
310 | 310 | } else { |
311 | 311 | $this->tokens[$tokenName] .= chr($ord); |