Test Setup Failed
Pull Request — master (#21)
by Alexandr
02:04
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();
@@ -150,28 +150,28 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
     {
223 223
         start:
224 224
         $ord = $this->stream->ord();
225
-        if($ord === AsciiChar::NULL) {
225
+        if ($ord === AsciiChar::NULL) {
226 226
             return;
227 227
         }
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
 block discarded – undo
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
         }
@@ -264,53 +264,53 @@  discard block
 block discarded – undo
264 264
         $ord = $this->stream->ord();
265 265
         $this->stream->next();
266 266
 
267
-        if($ord === 0) { // if end of record
267
+        if ($ord === 0) { // if end of record
268 268
             return;
269 269
         }
270 270
 
271 271
         // comment starts
272
-        if($ord === 59) {
272
+        if ($ord === 59) {
273 273
             $this->commentOpen = true;
274 274
             goto start;
275
-        } elseif($this->commentOpen === true && $ord !== 10) {
275
+        } elseif ($this->commentOpen === true && $ord !== 10) {
276 276
             $this->commentOpen = true;
277 277
             goto start;
278
-        } elseif($this->commentOpen === true && ($ord === 10 || $ord === 0)) {
278
+        } elseif ($this->commentOpen === true && ($ord === 10 || $ord === 0)) {
279 279
             $this->stream->previous();
280 280
             $this->commentOpen = false;
281 281
             goto start;
282 282
         } else {
283 283
             // ignore blanck line
284
-            if($ord === 32) {
284
+            if ($ord === 32) {
285 285
                 goto start;
286 286
             }
287 287
 
288 288
             // Find starts of char set
289
-            if($ord === 34 && !$this->commentOpen) { // "
289
+            if ($ord === 34 && !$this->commentOpen) { // "
290 290
                 $this->extractCharSet($tokenName);
291 291
             }
292 292
 
293 293
             // multi line opened
294
-            if($ord === 40 && !$this->commentOpen) {
294
+            if ($ord === 40 && !$this->commentOpen) {
295 295
                 $this->multiLineOpened = true;
296 296
                 goto start;
297 297
             }
298 298
 
299 299
             // multi line closed
300
-            if($this->multiLineOpened && !$this->commentOpen && $ord === 41) {
300
+            if ($this->multiLineOpened && !$this->commentOpen && $ord === 41) {
301 301
                 $this->multiLineOpened = false;
302 302
                 goto start;
303 303
             }
304 304
 
305 305
             // comment end in multi line TXT record
306
-            if($ord === 10 && $this->commentOpen && $this->multiLineOpened) {
306
+            if ($ord === 10 && $this->commentOpen && $this->multiLineOpened) {
307 307
                 goto start;
308 308
             }
309 309
 
310 310
             // is record ends?
311
-            if(!$this->multiLineOpened && ($ord === 10 || $ord === 0)) {
311
+            if (!$this->multiLineOpened && ($ord === 10 || $ord === 0)) {
312 312
                 return;
313
-            } elseif($this->multiLineOpened && $ord === 10) {
313
+            } elseif ($this->multiLineOpened && $ord === 10) {
314 314
                 goto start;
315 315
             }
316 316
         }
@@ -326,14 +326,14 @@  discard block
 block discarded – undo
326 326
         $ord = $this->stream->ord();
327 327
         $this->stream->next();
328 328
 
329
-        if($ord === AsciiChar::NULL) { // if end of record
329
+        if ($ord === AsciiChar::NULL) { // if end of record
330 330
             throw new SyntaxErrorException($this->stream);
331 331
         }
332 332
 
333
-        if(!$escaping_open && $ord === 34) {
333
+        if (!$escaping_open && $ord === 34) {
334 334
             $this->txtExtractor($tokenName);
335 335
         } else {
336
-            if($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) {
336
+            if ($ord === AsciiChar::LINE_FEED || $ord === AsciiChar::VERTICAL_TAB || $ord === AsciiChar::NULL) {
337 337
                 $this->stream->previous();
338 338
                 throw new SyntaxErrorException($this->stream);
339 339
             }
Please login to merge, or discard this patch.