Completed
Push — master ( 593209...b6a8dc )
by Lars
02:22
created
src/voku/helper/HtmlDomParser.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments);
188 188
         }
189 189
 
190
-        throw new \BadMethodCallException('Method does not exist: ' . $name);
190
+        throw new \BadMethodCallException('Method does not exist: '.$name);
191 191
     }
192 192
 
193 193
     /**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                 &&
353 353
                 \trim($matches_after_html[1])
354 354
             ) {
355
-                $html = \str_replace($matches_after_html[0], $matches_after_html[1] . '</html>', $html);
355
+                $html = \str_replace($matches_after_html[0], $matches_after_html[1].'</html>', $html);
356 356
             }
357 357
         }
358 358
 
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
         }
368 368
 
369 369
         $html = \str_replace(
370
-            \array_map(static function ($e) {
371
-                return '<' . $e . '>';
370
+            \array_map(static function($e) {
371
+                return '<'.$e.'>';
372 372
             }, $this->selfClosingTags),
373
-            \array_map(static function ($e) {
374
-                return '<' . $e . '/>';
373
+            \array_map(static function($e) {
374
+                return '<'.$e.'/>';
375 375
             }, $this->selfClosingTags),
376 376
             $html
377 377
         );
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                 $this->keepBrokenHtml
413 413
             )
414 414
         ) {
415
-            $html = '<' . self::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>';
415
+            $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>';
416 416
         }
417 417
 
418 418
         $html = self::replaceToPreserveHtmlEntities($html);
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             /** @noinspection StringFragmentMisplacedInspection */
439 439
             if (\stripos('<?xml', $html) !== 0) {
440 440
                 $xmlHackUsed = true;
441
-                $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
441
+                $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
442 442
             }
443 443
 
444 444
             if ($html !== '') {
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
 
654 654
         // https://bugs.php.net/bug.php?id=73175
655 655
         $content = \str_replace(
656
-            \array_map(static function ($e) {
657
-                return '</' . $e . '>';
656
+            \array_map(static function($e) {
657
+                return '</'.$e.'>';
658 658
             }, $this->selfClosingTags),
659 659
             '',
660 660
             $content
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
 
980 980
             $html = (string) \preg_replace_callback(
981 981
                 '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
982
-                static function ($matches) {
983
-                    return $matches['start'] .
984
-                        '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
985
-                        $matches['value'] .
986
-                        '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
982
+                static function($matches) {
983
+                    return $matches['start'].
984
+                        '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
985
+                        $matches['value'].
986
+                        '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
987 987
                         $matches['end'];
988 988
                 },
989 989
                 $html
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 
996 996
             $html = (string) \preg_replace_callback(
997 997
                 '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
998
-                static function ($matches) {
998
+                static function($matches) {
999 999
                     $matches['broken'] = \str_replace(
1000 1000
                         ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
1001 1001
                         ['</', '<', '>'],
@@ -1003,9 +1003,9 @@  discard block
 block discarded – undo
1003 1003
                     );
1004 1004
 
1005 1005
                     self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
1006
-                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']);
1006
+                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']);
1007 1007
 
1008
-                    return $matches['start'] . $matchesHash . $matches['end'];
1008
+                    return $matches['start'].$matchesHash.$matches['end'];
1009 1009
                 },
1010 1010
                 $html
1011 1011
             );
@@ -1027,14 +1027,14 @@  discard block
 block discarded – undo
1027 1027
     {
1028 1028
         // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>]
1029 1029
         $tags = \implode('|', \array_map(
1030
-            static function ($value) {
1030
+            static function($value) {
1031 1031
                 return \preg_quote($value, '/');
1032 1032
             },
1033 1033
             $this->specialScriptTags
1034 1034
         ));
1035 1035
         $html = (string) \preg_replace_callback(
1036
-            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:' . $tags . ')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1037
-            function ($matches) {
1036
+            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:'.$tags.')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1037
+            function($matches) {
1038 1038
 
1039 1039
                 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
1040 1040
                 // because often this looks like non valid html in the template itself.
@@ -1044,18 +1044,18 @@  discard block
 block discarded – undo
1044 1044
                         $matches['innerContent'] = \str_replace('<\/', '</', $matches['innerContent']);
1045 1045
 
1046 1046
                         self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent'];
1047
-                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '' . self::$domHtmlBrokenHtmlHelper . '' . \crc32($matches['innerContent']);
1047
+                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = ''.self::$domHtmlBrokenHtmlHelper.''.\crc32($matches['innerContent']);
1048 1048
 
1049
-                        return $matches['start'] . $matchesHash . $matches['end'];
1049
+                        return $matches['start'].$matchesHash.$matches['end'];
1050 1050
                     }
1051 1051
                 }
1052 1052
 
1053 1053
                 // remove the html5 fallback
1054 1054
                 $matches[0] = \str_replace('<\/', '</', $matches[0]);
1055 1055
 
1056
-                $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script'));
1056
+                $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script'));
1057 1057
 
1058
-                return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>';
1058
+                return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>';
1059 1059
             },
1060 1060
             $html
1061 1061
         );
Please login to merge, or discard this patch.