@@ -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,25 +170,25 @@ discard block |
||
| 170 | 170 | $this->stream->next(); |
| 171 | 171 | } |
| 172 | 172 | goto start; |
| 173 | - } elseif(($this->stream->currentAscii()->isVerticalSpace() || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
| 173 | + } elseif (($this->stream->currentAscii()->isVerticalSpace() || $ord === AsciiChar::NULL) && $this->commentOpen) { |
|
| 174 | 174 | $this->stream->next(); |
| 175 | 175 | $this->stream->ignoreHorizontalSpace(); |
| 176 | 176 | $this->commentOpen = false; |
| 177 | 177 | goto start; |
| 178 | - } elseif($this->commentOpen) { |
|
| 178 | + } elseif ($this->commentOpen) { |
|
| 179 | 179 | $this->commentOpen = true; |
| 180 | 180 | $this->ignoreComment(); |
| 181 | 181 | goto start; |
| 182 | - } elseif(!$this->commentOpen) { |
|
| 183 | - if($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === '') { |
|
| 182 | + } elseif (!$this->commentOpen) { |
|
| 183 | + if ($ord === AsciiChar::SPACE && $this->tokens[$tokenName] === '') { |
|
| 184 | 184 | $this->stream->next(); |
| 185 | 185 | goto start; |
| 186 | - } elseif($this->stream->currentAscii()->isWhiteSpace()) { |
|
| 186 | + } elseif ($this->stream->currentAscii()->isWhiteSpace()) { |
|
| 187 | 187 | return; |
| 188 | 188 | } else { |
| 189 | 189 | $this->tokens[$tokenName] .= $this->stream->current(); |
| 190 | 190 | $this->stream->next(); |
| 191 | - if($this->stream->isEnd()) { |
|
| 191 | + if ($this->stream->isEnd()) { |
|
| 192 | 192 | $this->tokens[$tokenName] = trim($this->tokens[$tokenName]); |
| 193 | 193 | } |
| 194 | 194 | goto start; |
@@ -210,15 +210,15 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | start: |
| 212 | 212 | $ord = $this->stream->ord(); |
| 213 | - if($ord === AsciiChar::NULL) { |
|
| 213 | + if ($ord === AsciiChar::NULL) { |
|
| 214 | 214 | return; |
| 215 | 215 | } |
| 216 | - if($ord === AsciiChar::SEMICOLON) { |
|
| 216 | + if ($ord === AsciiChar::SEMICOLON) { |
|
| 217 | 217 | $this->stream->next(); |
| 218 | 218 | $this->commentOpen = true; |
| 219 | 219 | goto start; |
| 220 | - } elseif($this->commentOpen) { |
|
| 221 | - if($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 220 | + } elseif ($this->commentOpen) { |
|
| 221 | + if ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 222 | 222 | $this->commentOpen = false; |
| 223 | 223 | goto start; |
| 224 | 224 | } else { |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | $this->commentOpen = true; |
| 227 | 227 | goto start; |
| 228 | 228 | } |
| 229 | - } elseif(!$this->commentOpen) { |
|
| 230 | - if($this->multiLineOpened) { |
|
| 231 | - if($ord === AsciiChar::CLOSE_BRACKET) { |
|
| 229 | + } elseif (!$this->commentOpen) { |
|
| 230 | + if ($this->multiLineOpened) { |
|
| 231 | + if ($ord === AsciiChar::CLOSE_BRACKET) { |
|
| 232 | 232 | $this->multiLineOpened = false; |
| 233 | 233 | } |
| 234 | 234 | $this->stream->next(); |
| 235 | 235 | goto start; |
| 236 | - } elseif($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 236 | + } elseif ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) { |
|
| 237 | 237 | return; |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -252,53 +252,53 @@ discard block |
||
| 252 | 252 | $ord = $this->stream->ord(); |
| 253 | 253 | $this->stream->next(); |
| 254 | 254 | |
| 255 | - if($ord === 0) { // if end of record |
|
| 255 | + if ($ord === 0) { // if end of record |
|
| 256 | 256 | return; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // comment starts |
| 260 | - if($ord === 59) { |
|
| 260 | + if ($ord === 59) { |
|
| 261 | 261 | $this->commentOpen = true; |
| 262 | 262 | goto start; |
| 263 | - } elseif($this->commentOpen === true && $ord !== 10) { |
|
| 263 | + } elseif ($this->commentOpen === true && $ord !== 10) { |
|
| 264 | 264 | $this->commentOpen = true; |
| 265 | 265 | goto start; |
| 266 | - } elseif($this->commentOpen === true && ($ord === 10 || $ord === 0)) { |
|
| 266 | + } elseif ($this->commentOpen === true && ($ord === 10 || $ord === 0)) { |
|
| 267 | 267 | $this->stream->previous(); |
| 268 | 268 | $this->commentOpen = false; |
| 269 | 269 | goto start; |
| 270 | 270 | } else { |
| 271 | 271 | // ignore blanck line |
| 272 | - if($ord === 32) { |
|
| 272 | + if ($ord === 32) { |
|
| 273 | 273 | goto start; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Find starts of char set |
| 277 | - if($ord === 34 && !$this->commentOpen) { // " |
|
| 277 | + if ($ord === 34 && !$this->commentOpen) { // " |
|
| 278 | 278 | $this->extractCharSet($tokenName); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // multi line opened |
| 282 | - if($ord === 40 && !$this->commentOpen) { |
|
| 282 | + if ($ord === 40 && !$this->commentOpen) { |
|
| 283 | 283 | $this->multiLineOpened = true; |
| 284 | 284 | goto start; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // multi line closed |
| 288 | - if($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
| 288 | + if ($this->multiLineOpened && !$this->commentOpen && $ord === 41) { |
|
| 289 | 289 | $this->multiLineOpened = false; |
| 290 | 290 | goto start; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // comment end in multi line TXT record |
| 294 | - if($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
| 294 | + if ($ord === 10 && $this->commentOpen && $this->multiLineOpened) { |
|
| 295 | 295 | goto start; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // is record ends? |
| 299 | - if(!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
| 299 | + if (!$this->multiLineOpened && ($ord === 10 || $ord === 0)) { |
|
| 300 | 300 | return; |
| 301 | - } elseif($this->multiLineOpened && $ord === 10) { |
|
| 301 | + } elseif ($this->multiLineOpened && $ord === 10) { |
|
| 302 | 302 | goto start; |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -314,14 +314,14 @@ discard block |
||
| 314 | 314 | $ord = $this->stream->ord(); |
| 315 | 315 | $this->stream->next(); |
| 316 | 316 | |
| 317 | - if($ord === AsciiChar::NULL) { // if end of record |
|
| 317 | + if ($ord === AsciiChar::NULL) { // if end of record |
|
| 318 | 318 | throw new SyntaxErrorException($this->stream); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if(!$escaping_open && $ord === 34) { |
|
| 321 | + if (!$escaping_open && $ord === 34) { |
|
| 322 | 322 | $this->txtExtractor($tokenName); |
| 323 | 323 | } else { |
| 324 | - if($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) { |
|
| 324 | + if ($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) { |
|
| 325 | 325 | $this->stream->previous(); |
| 326 | 326 | throw new SyntaxErrorException($this->stream); |
| 327 | 327 | } |