Completed
Pull Request — master (#58)
by
unknown
04:25
created
src/voku/helper/HtmlDomParser.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments);
213 213
         }
214 214
 
215
-        throw new \BadMethodCallException('Method does not exist: ' . $name);
215
+        throw new \BadMethodCallException('Method does not exist: '.$name);
216 216
     }
217 217
 
218 218
     /**
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                 &&
382 382
                 trim($matches_after_html[1])
383 383
             ) {
384
-                $html = str_replace($matches_after_html[0], $matches_after_html[1] . '</html>', $html);
384
+                $html = str_replace($matches_after_html[0], $matches_after_html[1].'</html>', $html);
385 385
             }
386 386
         }
387 387
 
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
         }
397 397
 
398 398
         $html = str_replace(
399
-            array_map(static function ($e) {
400
-                return '<' . $e . '>';
399
+            array_map(static function($e) {
400
+                return '<'.$e.'>';
401 401
             }, $this->selfClosingTags),
402
-            array_map(static function ($e) {
403
-                return '<' . $e . '/>';
402
+            array_map(static function($e) {
403
+                return '<'.$e.'/>';
404 404
             }, $this->selfClosingTags),
405 405
             $html
406 406
         );
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                 $this->keepBrokenHtml
442 442
             )
443 443
         ) {
444
-            $html = '<' . self::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>';
444
+            $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>';
445 445
         }
446 446
 
447 447
         $html = self::replaceToPreserveHtmlEntities($html);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             /** @noinspection StringFragmentMisplacedInspection */
468 468
             if (stripos('<?xml', $html) !== 0) {
469 469
                 $xmlHackUsed = true;
470
-                $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
470
+                $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
471 471
             }
472 472
 
473 473
             $this->document->loadHTML($html, $optionsXml);
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 
681 681
         // https://bugs.php.net/bug.php?id=73175
682 682
         $content = str_replace(
683
-            array_map(static function ($e) {
684
-                return '</' . $e . '>';
683
+            array_map(static function($e) {
684
+                return '</'.$e.'>';
685 685
             }, $this->selfClosingTags),
686 686
             '',
687 687
             $content
@@ -1006,11 +1006,11 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
             $html = (string) \preg_replace_callback(
1008 1008
                 '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
1009
-                static function ($matches) {
1010
-                    return $matches['start'] .
1011
-                        '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
1012
-                        $matches['value'] .
1013
-                        '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
1009
+                static function($matches) {
1010
+                    return $matches['start'].
1011
+                        '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
1012
+                        $matches['value'].
1013
+                        '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
1014 1014
                         $matches['end'];
1015 1015
                 },
1016 1016
                 $html
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
             $html = (string) \preg_replace_callback(
1024 1024
                 '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
1025
-                static function ($matches) {
1025
+                static function($matches) {
1026 1026
                     $matches['broken'] = str_replace(
1027 1027
                         ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
1028 1028
                         ['</', '<', '>'],
@@ -1030,9 +1030,9 @@  discard block
 block discarded – undo
1030 1030
                     );
1031 1031
 
1032 1032
                     self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
1033
-                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']);
1033
+                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']);
1034 1034
 
1035
-                    return $matches['start'] . $matchesHash . $matches['end'];
1035
+                    return $matches['start'].$matchesHash.$matches['end'];
1036 1036
                 },
1037 1037
                 $html
1038 1038
             );
@@ -1054,14 +1054,14 @@  discard block
 block discarded – undo
1054 1054
     {
1055 1055
         // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>]
1056 1056
         $tags = \implode('|', array_map(
1057
-            static function ($value) {
1057
+            static function($value) {
1058 1058
                 return \preg_quote($value, '/');
1059 1059
             },
1060 1060
             $this->specialScriptTags
1061 1061
         ));
1062 1062
         $html = (string) \preg_replace_callback(
1063
-            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:' . $tags . ')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1064
-            function ($matches) {
1063
+            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:'.$tags.')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1064
+            function($matches) {
1065 1065
 
1066 1066
                 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
1067 1067
                 // because often this looks like non valid html in the template itself.
@@ -1071,18 +1071,18 @@  discard block
 block discarded – undo
1071 1071
                         $matches['innerContent'] = str_replace('<\/', '</', $matches['innerContent']);
1072 1072
 
1073 1073
                         self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent'];
1074
-                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '' . self::$domHtmlBrokenHtmlHelper . '' . \crc32($matches['innerContent']);
1074
+                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = ''.self::$domHtmlBrokenHtmlHelper.''.\crc32($matches['innerContent']);
1075 1075
 
1076
-                        return $matches['start'] . $matchesHash . $matches['end'];
1076
+                        return $matches['start'].$matchesHash.$matches['end'];
1077 1077
                     }
1078 1078
                 }
1079 1079
 
1080 1080
                 // remove the html5 fallback
1081 1081
                 $matches[0] = str_replace('<\/', '</', $matches[0]);
1082 1082
 
1083
-                $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script'));
1083
+                $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script'));
1084 1084
 
1085
-                return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>';
1085
+                return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>';
1086 1086
             },
1087 1087
             $html
1088 1088
         );
Please login to merge, or discard this patch.