@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function __construct(StringStream $stream, string $type) |
102 | 102 | { |
103 | - if (! self::isKnownType($type)) { |
|
103 | + if (!self::isKnownType($type)) { |
|
104 | 104 | throw new SyntaxErrorException($stream); |
105 | 105 | } |
106 | 106 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function defaultExtractor(string $tokenName) |
138 | 138 | { |
139 | - if($this->multiLineOpened) { |
|
139 | + if ($this->multiLineOpened) { |
|
140 | 140 | $this->stream->ignoreWhitespace(); |
141 | 141 | } else { |
142 | 142 | $this->stream->ignoreHorizontalSpace(); |
@@ -152,27 +152,27 @@ discard block |
||
152 | 152 | |
153 | 153 | $ord = $this->stream->ord(); |
154 | 154 | |
155 | - if($ord === AsciiChar::NULL) { |
|
155 | + if ($ord === AsciiChar::NULL) { |
|
156 | 156 | return; |
157 | 157 | } |
158 | 158 | |
159 | - if($ord === AsciiChar::OPEN_BRACKET && !$this->commentOpen) { |
|
159 | + if ($ord === AsciiChar::OPEN_BRACKET && !$this->commentOpen) { |
|
160 | 160 | $this->multiLineOpened = true; |
161 | 161 | $this->stream->next(); |
162 | 162 | goto start; |
163 | - } elseif($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::CLOSE_BRACKET) { |
|
163 | + } elseif ($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::CLOSE_BRACKET) { |
|
164 | 164 | $this->multiLineOpened = false; |
165 | 165 | $this->stream->next(); |
166 | 166 | goto start; |
167 | - } elseif($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::LINE_FEED) { |
|
167 | + } elseif ($this->multiLineOpened && !$this->commentOpen && $ord === AsciiChar::LINE_FEED) { |
|
168 | 168 | $this->stream->next(); |
169 | 169 | goto start; |
170 | - } elseif($ord === AsciiChar::LINE_FEED && !$this->commentOpen) { |
|
170 | + } elseif ($ord === AsciiChar::LINE_FEED && !$this->commentOpen) { |
|
171 | 171 | return; |
172 | 172 | } else { |
173 | - if($ord === AsciiChar::SEMICOLON) { |
|
173 | + if ($ord === AsciiChar::SEMICOLON) { |
|
174 | 174 | $this->stream->previous(); |
175 | - if($this->stream->currentAscii()->isHorizontalSpace()) { |
|
175 | + if ($this->stream->currentAscii()->isHorizontalSpace()) { |
|
176 | 176 | |
177 | 177 | $this->commentOpen = true; |
178 | 178 | $this->stream->next(); |
@@ -183,25 +183,25 @@ discard block |
||
183 | 183 | $this->stream->next(); |
184 | 184 | } |
185 | 185 | goto start; |
186 | - } elseif(($this->stream->currentAscii()->isVerticalSpace() || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
186 | + } elseif (($this->stream->currentAscii()->isVerticalSpace() || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
187 | 187 | $this->stream->next(); |
188 | 188 | $this->stream->ignoreHorizontalSpace(); |
189 | 189 | $this->commentOpen = false; |
190 | 190 | goto start; |
191 | - } elseif($this->commentOpen) { |
|
191 | + } elseif ($this->commentOpen) { |
|
192 | 192 | $this->commentOpen = true; |
193 | 193 | $this->ignoreComment(); |
194 | 194 | goto start; |
195 | - } elseif(!$this->commentOpen) { |
|
196 | - if($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === '') { |
|
195 | + } elseif (!$this->commentOpen) { |
|
196 | + if ($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === '') { |
|
197 | 197 | $this->stream->next(); |
198 | 198 | goto start; |
199 | - } elseif($this->stream->currentAscii()->isWhiteSpace()) { |
|
199 | + } elseif ($this->stream->currentAscii()->isWhiteSpace()) { |
|
200 | 200 | return; |
201 | 201 | } else { |
202 | 202 | $this->tokens[$tokenName] .= $this->stream->current(); |
203 | 203 | $this->stream->next(); |
204 | - if($this->stream->isEnd()) { |
|
204 | + if ($this->stream->isEnd()) { |
|
205 | 205 | $this->tokens[$tokenName] = trim($this->tokens[$tokenName]); |
206 | 206 | return; |
207 | 207 | } |
@@ -224,15 +224,15 @@ discard block |
||
224 | 224 | { |
225 | 225 | start: |
226 | 226 | $ord = $this->stream->ord(); |
227 | - if($ord === AsciiChar::NULL) { |
|
227 | + if ($ord === AsciiChar::NULL) { |
|
228 | 228 | return; |
229 | 229 | } |
230 | - if($ord === AsciiChar::SEMICOLON) { |
|
230 | + if ($ord === AsciiChar::SEMICOLON) { |
|
231 | 231 | $this->stream->next(); |
232 | 232 | $this->commentOpen = true; |
233 | 233 | goto start; |
234 | - } elseif($this->commentOpen) { |
|
235 | - if($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
234 | + } elseif ($this->commentOpen) { |
|
235 | + if ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
236 | 236 | $this->commentOpen = false; |
237 | 237 | goto start; |
238 | 238 | } else { |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | $this->commentOpen = true; |
241 | 241 | goto start; |
242 | 242 | } |
243 | - } elseif(!$this->commentOpen) { |
|
244 | - if($this->multiLineOpened) { |
|
245 | - if($ord === AsciiChar::CLOSE_BRACKET) { |
|
243 | + } elseif (!$this->commentOpen) { |
|
244 | + if ($this->multiLineOpened) { |
|
245 | + if ($ord === AsciiChar::CLOSE_BRACKET) { |
|
246 | 246 | $this->multiLineOpened = false; |
247 | 247 | } |
248 | 248 | $this->stream->next(); |
249 | 249 | goto start; |
250 | - } elseif($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
250 | + } elseif ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
251 | 251 | return; |
252 | 252 | } |
253 | 253 | } |
@@ -266,53 +266,53 @@ discard block |
||
266 | 266 | $ord = $this->stream->ord(); |
267 | 267 | $this->stream->next(); |
268 | 268 | |
269 | - if($ord === 0) { // if end of record |
|
269 | + if ($ord === 0) { // if end of record |
|
270 | 270 | return; |
271 | 271 | } |
272 | 272 | |
273 | 273 | // comment starts |
274 | - if($ord === 59) { |
|
274 | + if ($ord === 59) { |
|
275 | 275 | $this->commentOpen = true; |
276 | 276 | goto start; |
277 | - } elseif($this->commentOpen === true && $ord !== 10) { |
|
277 | + } elseif ($this->commentOpen === true && $ord !== 10) { |
|
278 | 278 | $this->commentOpen = true; |
279 | 279 | goto start; |
280 | - } elseif($this->commentOpen === true && ($ord === 10 || $ord === 0)) { |
|
280 | + } elseif ($this->commentOpen === true && ($ord === 10 || $ord === 0)) { |
|
281 | 281 | $this->stream->previous(); |
282 | 282 | $this->commentOpen = false; |
283 | 283 | goto start; |
284 | 284 | } else { |
285 | 285 | // ignore blanck line |
286 | - if($ord === 32) { |
|
286 | + if ($ord === 32) { |
|
287 | 287 | goto start; |
288 | 288 | } |
289 | 289 | |
290 | 290 | // Find starts of char set |
291 | - if($ord === 34 && !$this->commentOpen) { // " |
|
291 | + if ($ord === 34 && !$this->commentOpen) { // " |
|
292 | 292 | $this->extractCharSet($tokenName); |
293 | 293 | } |
294 | 294 | |
295 | 295 | // multi line opened |
296 | - if($ord === 40 && !$this->commentOpen) { |
|
296 | + if ($ord === 40 && !$this->commentOpen) { |
|
297 | 297 | $this->multiLineOpened = true; |
298 | 298 | goto start; |
299 | 299 | } |
300 | 300 | |
301 | 301 | // multi line closed |
302 | - if($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
302 | + if ($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
303 | 303 | $this->multiLineOpened = false; |
304 | 304 | goto start; |
305 | 305 | } |
306 | 306 | |
307 | 307 | // comment end in multi line TXT record |
308 | - if($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
308 | + if ($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
309 | 309 | goto start; |
310 | 310 | } |
311 | 311 | |
312 | 312 | // is record ends? |
313 | - if(!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
313 | + if (!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
314 | 314 | return; |
315 | - } elseif($this->multiLineOpened && $ord === 10) { |
|
315 | + } elseif ($this->multiLineOpened && $ord === 10) { |
|
316 | 316 | goto start; |
317 | 317 | } |
318 | 318 | } |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | $ord = $this->stream->ord(); |
329 | 329 | $this->stream->next(); |
330 | 330 | |
331 | - if($ord === AsciiChar::NULL) { // if end of record |
|
331 | + if ($ord === AsciiChar::NULL) { // if end of record |
|
332 | 332 | throw new SyntaxErrorException($this->stream); |
333 | 333 | } |
334 | 334 | |
335 | - if(!$escaping_open && $ord === 34) { |
|
335 | + if (!$escaping_open && $ord === 34) { |
|
336 | 336 | $this->txtExtractor($tokenName); |
337 | 337 | } else { |
338 | - if($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) { |
|
338 | + if ($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) { |
|
339 | 339 | $this->stream->previous(); |
340 | 340 | throw new SyntaxErrorException($this->stream); |
341 | 341 | } |