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