@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @param bool $isFirst |
| 54 | 54 | * @param string $previousName |
| 55 | 55 | */ |
| 56 | - public function __construct |
|
| 57 | - ( |
|
| 56 | + public function __construct( |
|
| 58 | 57 | StringStream $stream, |
| 59 | 58 | ?string $globalOrigin = NULL, |
| 60 | 59 | ?string $globalTtl = NULL, |
@@ -112,8 +111,8 @@ discard block |
||
| 112 | 111 | $this->stream->ignoreHorizontalSpace(); |
| 113 | 112 | $this->extractRData(); |
| 114 | 113 | |
| 115 | - if($this->globalOrigin && substr($this->tokens['NAME'], -1) !== '.' && $this->tokens['NAME'] !== '@') { |
|
| 116 | - if($this->globalOrigin === '.') { |
|
| 114 | + if ($this->globalOrigin && substr($this->tokens['NAME'], -1) !== '.' && $this->tokens['NAME'] !== '@') { |
|
| 115 | + if ($this->globalOrigin === '.') { |
|
| 117 | 116 | $this->tokens['NAME'] .= $this->globalOrigin; |
| 118 | 117 | } else { |
| 119 | 118 | $this->tokens['NAME'] .= '.'.$this->globalOrigin; |
@@ -179,33 +178,33 @@ discard block |
||
| 179 | 178 | throw new SyntaxErrorException($this->stream); |
| 180 | 179 | } |
| 181 | 180 | } else { |
| 182 | - if($this->isFirst) { |
|
| 181 | + if ($this->isFirst) { |
|
| 183 | 182 | throw new SyntaxErrorException($this->stream); |
| 184 | 183 | } else { |
| 185 | - if(RData::isKnownType($this->tokens['NAME']) && ! RData::isKnownType($this->tokens['TTL'])) { |
|
| 184 | + if (RData::isKnownType($this->tokens['NAME']) && !RData::isKnownType($this->tokens['TTL'])) { |
|
| 186 | 185 | // no ttl and no origin in record, and in TTL Rdata |
| 187 | 186 | last_chance: |
| 188 | - if($this->previousName && $this->globalTtl) { |
|
| 187 | + if ($this->previousName && $this->globalTtl) { |
|
| 189 | 188 | $this->tokens['TYPE'] = $this->tokens['NAME']; |
| 190 | 189 | $this->tokens['NAME'] = $this->previousName; |
| 191 | 190 | $this->tokens['TTL'] = $this->globalTtl; |
| 192 | 191 | } else { |
| 193 | 192 | throw new SyntaxErrorException($this->stream); |
| 194 | 193 | } |
| 195 | - } elseif(!RData::isKnownType($this->tokens['NAME']) && RData::isKnownType($this->tokens['TTL'])) { |
|
| 194 | + } elseif (!RData::isKnownType($this->tokens['NAME']) && RData::isKnownType($this->tokens['TTL'])) { |
|
| 196 | 195 | $this->tokens['TYPE'] = $this->tokens['TTL']; |
| 197 | - if($this->previousName && ! $this->globalTtl) { |
|
| 198 | - $this->tokens['TTL'] = $this->tokens['NAME']; |
|
| 196 | + if ($this->previousName && !$this->globalTtl) { |
|
| 197 | + $this->tokens['TTL'] = $this->tokens['NAME']; |
|
| 199 | 198 | $this->tokens['NAME'] = $this->previousName; |
| 200 | - } elseif(! $this->previousName && $this->globalTtl) { |
|
| 201 | - $this->tokens['TTL'] = $this->globalTtl; |
|
| 202 | - } elseif($this->previousName && $this->globalTtl) { |
|
| 199 | + } elseif (!$this->previousName && $this->globalTtl) { |
|
| 200 | + $this->tokens['TTL'] = $this->globalTtl; |
|
| 201 | + } elseif ($this->previousName && $this->globalTtl) { |
|
| 203 | 202 | $this->tokens['TTL'] = $this->globalTtl; |
| 204 | 203 | } else { |
| 205 | 204 | throw new SyntaxErrorException($this->stream); |
| 206 | 205 | } |
| 207 | 206 | |
| 208 | - } elseif(RData::isKnownType($this->tokens['NAME']) && RData::isKnownType($this->tokens['TTL'])) { |
|
| 207 | + } elseif (RData::isKnownType($this->tokens['NAME']) && RData::isKnownType($this->tokens['TTL'])) { |
|
| 209 | 208 | goto last_chance; |
| 210 | 209 | } else { |
| 211 | 210 | throw new SyntaxErrorException($this->stream); |
@@ -214,12 +213,12 @@ discard block |
||
| 214 | 213 | do { |
| 215 | 214 | $char = $this->stream->currentAscii(); |
| 216 | 215 | $this->stream->previous(); |
| 217 | - } while($char->isWhiteSpace()); |
|
| 216 | + } while ($char->isWhiteSpace()); |
|
| 218 | 217 | |
| 219 | 218 | do { |
| 220 | 219 | $char = $this->stream->currentAscii(); |
| 221 | 220 | $this->stream->previous(); |
| 222 | - } while($char->isPrintableChar() && ! $char->isHorizontalSpace()); |
|
| 221 | + } while ($char->isPrintableChar() && !$char->isHorizontalSpace()); |
|
| 223 | 222 | } |
| 224 | 223 | } |
| 225 | 224 | } |