Completed
Pull Request — master (#158)
by Christophe
09:52
created
src/HTML5/Parser/Tokenizer.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             return $this->text($tok);
244 244
         }
245 245
 
246
-        $sequence = '</' . $this->untilTag . '>';
246
+        $sequence = '</'.$this->untilTag.'>';
247 247
         $txt = $this->readUntilSequence($sequence);
248 248
         $this->events->text($txt);
249 249
         $this->setTextMode(0);
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
             return $this->text($tok);
265 265
         }
266 266
 
267
-        $sequence = '</' . $this->untilTag;
267
+        $sequence = '</'.$this->untilTag;
268 268
         $txt = '';
269 269
 
270 270
         $caseSensitive = !Elements::isHtml5Element($this->untilTag);
271
-        while ($tok !== false && ! ($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) {
271
+        while ($tok !== false && !($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) {
272 272
             if ($tok == '&') {
273 273
                 $txt .= $this->decodeCharacterReference();
274 274
                 $tok = $this->scanner->current();
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         // > -> parse error
355 355
         // EOF -> parse error
356 356
         // -> parse error
357
-        if (! ctype_alpha($tok)) {
357
+        if (!ctype_alpha($tok)) {
358 358
             $this->parseError("Expected tag name, got '%s'", $tok);
359 359
             if ($tok == "\0" || $tok === false) {
360 360
                 return false;
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
         }
364 364
 
365 365
         $name = $this->scanner->charsUntil("\n\f \t>");
366
-        $name = $this->mode === self::CONFORMANT_XML ? $name: strtolower($name);
366
+        $name = $this->mode === self::CONFORMANT_XML ? $name : strtolower($name);
367 367
         // Trash whitespace.
368 368
         $this->scanner->whitespace();
369 369
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     protected function tagName()
387 387
     {
388 388
         $tok = $this->scanner->current();
389
-        if (! ctype_alpha($tok)) {
389
+        if (!ctype_alpha($tok)) {
390 390
             return false;
391 391
         }
392 392
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
             do {
403 403
                 $this->scanner->whitespace();
404 404
                 $this->attribute($attributes);
405
-            } while (! $this->isTagEnd($selfClose));
405
+            } while (!$this->isTagEnd($selfClose));
406 406
         } catch (ParseError $e) {
407 407
             $selfClose = false;
408 408
         }
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
      */
570 570
     protected function quotedAttributeValue($quote)
571 571
     {
572
-        $stoplist = "\f" . $quote;
572
+        $stoplist = "\f".$quote;
573 573
         $val = '';
574 574
 
575 575
         while (true) {
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
         if ($tok == "\0") {
672 672
             $tok = UTF8Utils::FFFD;
673 673
         }
674
-        while (! $this->isCommentEnd()) {
674
+        while (!$this->isCommentEnd()) {
675 675
             $comment .= $tok;
676 676
             $tok = $this->scanner->next();
677 677
         }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
         $chars = $this->scanner->charsWhile("DOCTYPEdoctype");
732 732
         if (strcasecmp($chars, 'DOCTYPE')) {
733 733
             $this->parseError('Expected DOCTYPE, got %s', $chars);
734
-            return $this->bogusComment('<!' . $chars);
734
+            return $this->bogusComment('<!'.$chars);
735 735
         }
736 736
 
737 737
         $this->scanner->whitespace();
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
         $tok = $this->scanner->current();
839 839
         if ($tok == '"' || $tok == "'") {
840 840
             $this->scanner->consume();
841
-            $ret = $this->scanner->charsUntil($tok . $stopchars);
841
+            $ret = $this->scanner->charsUntil($tok.$stopchars);
842 842
             if ($this->scanner->current() == $tok) {
843 843
                 $this->scanner->consume();
844 844
             } else {
@@ -866,19 +866,19 @@  discard block
 block discarded – undo
866 866
         $chars = $this->scanner->charsWhile('CDAT');
867 867
         if ($chars != 'CDATA' || $this->scanner->current() != '[') {
868 868
             $this->parseError('Expected [CDATA[, got %s', $chars);
869
-            return $this->bogusComment('<![' . $chars);
869
+            return $this->bogusComment('<!['.$chars);
870 870
         }
871 871
 
872 872
         $tok = $this->scanner->next();
873 873
         do {
874 874
             if ($tok === false) {
875 875
                 $this->parseError('Unexpected EOF inside CDATA.');
876
-                $this->bogusComment('<![CDATA[' . $cdata);
876
+                $this->bogusComment('<![CDATA['.$cdata);
877 877
                 return true;
878 878
             }
879 879
             $cdata .= $tok;
880 880
             $tok = $this->scanner->next();
881
-        } while (! $this->scanner->sequenceMatches(']]>'));
881
+        } while (!$this->scanner->sequenceMatches(']]>'));
882 882
 
883 883
         // Consume ]]>
884 884
         $this->scanner->consume(3);
@@ -913,13 +913,13 @@  discard block
 block discarded – undo
913 913
         // If not a PI, send to bogusComment.
914 914
         if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) {
915 915
             $this->parseError("Expected processing instruction name, got $tok");
916
-            $this->bogusComment('<?' . $tok . $procName);
916
+            $this->bogusComment('<?'.$tok.$procName);
917 917
             return true;
918 918
         }
919 919
 
920 920
         $data = '';
921 921
         // As long as it's not the case that the next two chars are ? and >.
922
-        while (! ($this->scanner->current() == '?' && $this->scanner->peek() == '>')) {
922
+        while (!($this->scanner->current() == '?' && $this->scanner->peek() == '>')) {
923 923
             $data .= $this->scanner->current();
924 924
 
925 925
             $tok = $this->scanner->next();
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
      */
990 990
     protected function sequenceMatches($sequence, $caseSensitive = true)
991 991
     {
992
-        @trigger_error(__METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED);
992
+        @trigger_error(__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED);
993 993
 
994 994
         return $this->scanner->sequenceMatches($sequence, $caseSensitive);
995 995
     }
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
         // These indicate not an entity. We return just
1073 1073
         // the &.
1074
-        if (strspn($tok, static::WHITE . "&<") == 1) {
1074
+        if (strspn($tok, static::WHITE."&<") == 1) {
1075 1075
             // $this->scanner->next();
1076 1076
             return '&';
1077 1077
         }
@@ -1148,6 +1148,6 @@  discard block
 block discarded – undo
1148 1148
         }
1149 1149
 
1150 1150
         $this->parseError("Expected &ENTITY;, got &ENTITY%s (no trailing ;) ", $tok);
1151
-        return '&' . $entity;
1151
+        return '&'.$entity;
1152 1152
     }
1153 1153
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -6 removed lines patch added patch discarded remove patch
@@ -323,13 +323,9 @@
 block discarded – undo
323 323
         if ($tok == '-' && $this->scanner->peek() == '-') {
324 324
             $this->scanner->consume(2);
325 325
             return $this->comment();
326
-        }
327
-
328
-        elseif ($tok == 'D' || $tok == 'd') { // Doctype
326
+        } elseif ($tok == 'D' || $tok == 'd') { // Doctype
329 327
             return $this->doctype();
330
-        }
331
-
332
-        elseif ($tok == '[') { // CDATA section
328
+        } elseif ($tok == '[') { // CDATA section
333 329
             return $this->cdataSection();
334 330
         }
335 331
 
Please login to merge, or discard this patch.