Completed
Pull Request — master (#154)
by Christophe
01:38
created
src/HTML5/Parser/Tokenizer.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             return $this->text($tok);
242 242
         }
243 243
 
244
-        $sequence = '</' . $this->untilTag . '>';
244
+        $sequence = '</'.$this->untilTag.'>';
245 245
         $txt = $this->readUntilSequence($sequence);
246 246
         $this->events->text($txt);
247 247
         $this->setTextMode(0);
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
             return $this->text($tok);
263 263
         }
264 264
 
265
-        $sequence = '</' . $this->untilTag;
265
+        $sequence = '</'.$this->untilTag;
266 266
         $txt = '';
267 267
 
268 268
         $caseSensitive = !Elements::isHtml5Element($this->untilTag);
269
-        while ($tok !== false && ! ($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) {
269
+        while ($tok !== false && !($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) {
270 270
             if ($tok == '&') {
271 271
                 $txt .= $this->decodeCharacterReference();
272 272
                 $tok = $this->scanner->current();
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         // > -> parse error
354 354
         // EOF -> parse error
355 355
         // -> parse error
356
-        if (! ctype_alpha($tok)) {
356
+        if (!ctype_alpha($tok)) {
357 357
             $this->parseError("Expected tag name, got '%s'", $tok);
358 358
             if ($tok == "\0" || $tok === false) {
359 359
                 return false;
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         }
363 363
 
364 364
         $name = $this->scanner->charsUntil("\n\f \t>");
365
-        $name = $this->mode === self::CONFORMANT_XML ? $name: strtolower($name);
365
+        $name = $this->mode === self::CONFORMANT_XML ? $name : strtolower($name);
366 366
         // Trash whitespace.
367 367
         $this->scanner->whitespace();
368 368
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     protected function tagName()
386 386
     {
387 387
         $tok = $this->scanner->current();
388
-        if (! ctype_alpha($tok)) {
388
+        if (!ctype_alpha($tok)) {
389 389
             return false;
390 390
         }
391 391
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             do {
402 402
                 $this->scanner->whitespace();
403 403
                 $this->attribute($attributes);
404
-            } while (! $this->isTagEnd($selfClose));
404
+            } while (!$this->isTagEnd($selfClose));
405 405
         } catch (ParseError $e) {
406 406
             $selfClose = false;
407 407
         }
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
      */
569 569
     protected function quotedAttributeValue($quote)
570 570
     {
571
-        $stoplist = "\f" . $quote;
571
+        $stoplist = "\f".$quote;
572 572
         $val = '';
573 573
 
574 574
         while (true) {
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         if ($tok == "\0") {
670 670
             $tok = UTF8Utils::FFFD;
671 671
         }
672
-        while (! $this->isCommentEnd()) {
672
+        while (!$this->isCommentEnd()) {
673 673
             $comment .= $tok;
674 674
             $tok = $this->scanner->next();
675 675
         }
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
         $chars = $this->scanner->charsWhile("DOCTYPEdoctype");
730 730
         if (strcasecmp($chars, 'DOCTYPE')) {
731 731
             $this->parseError('Expected DOCTYPE, got %s', $chars);
732
-            return $this->bogusComment('<!' . $chars);
732
+            return $this->bogusComment('<!'.$chars);
733 733
         }
734 734
 
735 735
         $this->scanner->whitespace();
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
         $tok = $this->scanner->current();
837 837
         if ($tok == '"' || $tok == "'") {
838 838
             $this->scanner->next();
839
-            $ret = $this->scanner->charsUntil($tok . $stopchars);
839
+            $ret = $this->scanner->charsUntil($tok.$stopchars);
840 840
             if ($this->scanner->current() == $tok) {
841 841
                 $this->scanner->next();
842 842
             } else {
@@ -864,19 +864,19 @@  discard block
 block discarded – undo
864 864
         $chars = $this->scanner->charsWhile('CDAT');
865 865
         if ($chars != 'CDATA' || $this->scanner->current() != '[') {
866 866
             $this->parseError('Expected [CDATA[, got %s', $chars);
867
-            return $this->bogusComment('<![' . $chars);
867
+            return $this->bogusComment('<!['.$chars);
868 868
         }
869 869
 
870 870
         $tok = $this->scanner->next();
871 871
         do {
872 872
             if ($tok === false) {
873 873
                 $this->parseError('Unexpected EOF inside CDATA.');
874
-                $this->bogusComment('<![CDATA[' . $cdata);
874
+                $this->bogusComment('<![CDATA['.$cdata);
875 875
                 return true;
876 876
             }
877 877
             $cdata .= $tok;
878 878
             $tok = $this->scanner->next();
879
-        } while (! $this->scanner->sequenceMatches(']]>'));
879
+        } while (!$this->scanner->sequenceMatches(']]>'));
880 880
 
881 881
         // Consume ]]>
882 882
         $this->scanner->consume(3);
@@ -911,13 +911,13 @@  discard block
 block discarded – undo
911 911
         // If not a PI, send to bogusComment.
912 912
         if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) {
913 913
             $this->parseError("Expected processing instruction name, got $tok");
914
-            $this->bogusComment('<?' . $tok . $procName);
914
+            $this->bogusComment('<?'.$tok.$procName);
915 915
             return true;
916 916
         }
917 917
 
918 918
         $data = '';
919 919
         // As long as it's not the case that the next two chars are ? and >.
920
-        while (! ($this->scanner->current() == '?' && $this->scanner->peek() == '>')) {
920
+        while (!($this->scanner->current() == '?' && $this->scanner->peek() == '>')) {
921 921
             $data .= $this->scanner->current();
922 922
 
923 923
             $tok = $this->scanner->next();
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
      */
989 989
     protected function sequenceMatches($sequence, $caseSensitive = true)
990 990
     {
991
-        @trigger_error(__METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED);
991
+        @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 992
 
993 993
         return $this->scanner->sequenceMatches($sequence, $caseSensitive);
994 994
     }
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
         // These indicate not an entity. We return just
1072 1072
         // the &.
1073
-        if ($tok === "\t" || $tok === "\n" || $tok === "\f" ||$tok === ' ' || $tok === '&' || $tok === '<') {
1073
+        if ($tok === "\t" || $tok === "\n" || $tok === "\f" || $tok === ' ' || $tok === '&' || $tok === '<') {
1074 1074
             // $this->scanner->next();
1075 1075
             return '&';
1076 1076
         }
@@ -1147,6 +1147,6 @@  discard block
 block discarded – undo
1147 1147
         }
1148 1148
 
1149 1149
         $this->parseError("Expected &ENTITY;, got &ENTITY%s (no trailing ;) ", $tok);
1150
-        return '&' . $entity;
1150
+        return '&'.$entity;
1151 1151
     }
1152 1152
 }
Please login to merge, or discard this patch.