Test Setup Failed
Pull Request — master (#20)
by
unknown
02:09
created
src/LTDBeget/dns/Tokenizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@
 block discarded – undo
147 147
     private function extractRecord()
148 148
     {
149 149
         $isFirst = $this->recordsAmmount === 0;
150
-        if(! $isFirst ) {
150
+        if (!$isFirst) {
151 151
             $lastParsedRecord = end($this->tokens);
152 152
             $previousName = $lastParsedRecord['NAME'];
153 153
         } else {
Please login to merge, or discard this patch.
src/LTDBeget/dns/record/Record.php 1 patch
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/LTDBeget/dns/record/RData.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
152 152
 
153 153
         $ord = $this->stream->ord();
154 154
 
155
-        if($ord === AsciiChar::NULL || $this->stream->isEnd()) {
155
+        if ($ord === AsciiChar::NULL || $this->stream->isEnd()) {
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
 block discarded – undo
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
                     }
207 207
                     goto start;
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
     {
224 224
         start:
225 225
         $ord = $this->stream->ord();
226
-        if($ord === AsciiChar::NULL) {
226
+        if ($ord === AsciiChar::NULL) {
227 227
             return;
228 228
         }
229
-        if($ord === AsciiChar::SEMICOLON) {
229
+        if ($ord === AsciiChar::SEMICOLON) {
230 230
             $this->stream->next();
231 231
             $this->commentOpen = true;
232 232
             goto start;
233
-        } elseif($this->commentOpen) {
234
-            if($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) {
233
+        } elseif ($this->commentOpen) {
234
+            if ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) {
235 235
                 $this->commentOpen = false;
236 236
                 goto start;
237 237
             } else {
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
                 $this->commentOpen = true;
240 240
                 goto start;
241 241
             }
242
-        } elseif(!$this->commentOpen)  {
243
-            if($this->multiLineOpened) {
244
-                if($ord === AsciiChar::CLOSE_BRACKET) {
242
+        } elseif (!$this->commentOpen) {
243
+            if ($this->multiLineOpened) {
244
+                if ($ord === AsciiChar::CLOSE_BRACKET) {
245 245
                     $this->multiLineOpened = false;
246 246
                 }
247 247
                 $this->stream->next();
248 248
                 goto start;
249
-            } elseif($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) {
249
+            } elseif ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) {
250 250
                 return;
251 251
             }
252 252
         }
@@ -265,53 +265,53 @@  discard block
 block discarded – undo
265 265
         $ord = $this->stream->ord();
266 266
         $this->stream->next();
267 267
 
268
-        if($ord === 0) { // if end of record
268
+        if ($ord === 0) { // if end of record
269 269
             return;
270 270
         }
271 271
 
272 272
         // comment starts
273
-        if($ord === 59) {
273
+        if ($ord === 59) {
274 274
             $this->commentOpen = true;
275 275
             goto start;
276
-        } elseif($this->commentOpen === true && $ord !== 10) {
276
+        } elseif ($this->commentOpen === true && $ord !== 10) {
277 277
             $this->commentOpen = true;
278 278
             goto start;
279
-        } elseif($this->commentOpen === true && ($ord === 10 || $ord === 0)) {
279
+        } elseif ($this->commentOpen === true && ($ord === 10 || $ord === 0)) {
280 280
             $this->stream->previous();
281 281
             $this->commentOpen = false;
282 282
             goto start;
283 283
         } else {
284 284
             // ignore blanck line
285
-            if($ord === 32) {
285
+            if ($ord === 32) {
286 286
                 goto start;
287 287
             }
288 288
 
289 289
             // Find starts of char set
290
-            if($ord === 34 && !$this->commentOpen) { // "
290
+            if ($ord === 34 && !$this->commentOpen) { // "
291 291
                 $this->extractCharSet($tokenName);
292 292
             }
293 293
 
294 294
             // multi line opened
295
-            if($ord === 40 && !$this->commentOpen) {
295
+            if ($ord === 40 && !$this->commentOpen) {
296 296
                 $this->multiLineOpened = true;
297 297
                 goto start;
298 298
             }
299 299
 
300 300
             // multi line closed
301
-            if($this->multiLineOpened && !$this->commentOpen && $ord === 41) {
301
+            if ($this->multiLineOpened && !$this->commentOpen && $ord === 41) {
302 302
                 $this->multiLineOpened = false;
303 303
                 goto start;
304 304
             }
305 305
 
306 306
             // comment end in multi line TXT record
307
-            if($ord === 10 && $this->commentOpen && $this->multiLineOpened) {
307
+            if ($ord === 10 && $this->commentOpen && $this->multiLineOpened) {
308 308
                 goto start;
309 309
             }
310 310
 
311 311
             // is record ends?
312
-            if(!$this->multiLineOpened && ($ord === 10 || $ord === 0)) {
312
+            if (!$this->multiLineOpened && ($ord === 10 || $ord === 0)) {
313 313
                 return;
314
-            } elseif($this->multiLineOpened && $ord === 10) {
314
+            } elseif ($this->multiLineOpened && $ord === 10) {
315 315
                 goto start;
316 316
             }
317 317
         }
@@ -327,14 +327,14 @@  discard block
 block discarded – undo
327 327
         $ord = $this->stream->ord();
328 328
         $this->stream->next();
329 329
 
330
-        if($ord === AsciiChar::NULL) { // if end of record
330
+        if ($ord === AsciiChar::NULL) { // if end of record
331 331
             throw new SyntaxErrorException($this->stream);
332 332
         }
333 333
 
334
-        if(!$escaping_open && $ord === 34) {
334
+        if (!$escaping_open && $ord === 34) {
335 335
             $this->txtExtractor($tokenName);
336 336
         } else {
337
-            if($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) {
337
+            if ($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) {
338 338
                 $this->stream->previous();
339 339
                 throw new SyntaxErrorException($this->stream);
340 340
             }
Please login to merge, or discard this patch.