Completed
Push — master ( eb8cc8...612387 )
by Lars
01:52
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
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                 &&
340 340
                 \trim($matches_after_html[1])
341 341
             ) {
342
-                $html = \str_replace($matches_after_html[0], $matches_after_html[1] . '</html>', $html);
342
+                $html = \str_replace($matches_after_html[0], $matches_after_html[1].'</html>', $html);
343 343
             }
344 344
         }
345 345
 
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
         }
355 355
 
356 356
         $html = \str_replace(
357
-            \array_map(static function ($e) {
358
-                return '<' . $e . '>';
357
+            \array_map(static function($e) {
358
+                return '<'.$e.'>';
359 359
             }, $this->selfClosingTags),
360
-            \array_map(static function ($e) {
361
-                return '<' . $e . '/>';
360
+            \array_map(static function($e) {
361
+                return '<'.$e.'/>';
362 362
             }, $this->selfClosingTags),
363 363
             $html
364 364
         );
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             ||
394 394
             $this->keepBrokenHtml
395 395
         ) {
396
-            $html = '<' . self::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>';
396
+            $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>';
397 397
         }
398 398
 
399 399
         $html = self::replaceToPreserveHtmlEntities($html);
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
             /** @noinspection StringFragmentMisplacedInspection */
420 420
             if (\stripos('<?xml', $html) !== 0) {
421 421
                 $xmlHackUsed = true;
422
-                $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
422
+                $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
423 423
             }
424 424
 
425 425
             $this->document->loadHTML($html, $optionsXml);
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
 
631 631
         // https://bugs.php.net/bug.php?id=73175
632 632
         $content = \str_replace(
633
-            \array_map(static function ($e) {
634
-                return '</' . $e . '>';
633
+            \array_map(static function($e) {
634
+                return '</'.$e.'>';
635 635
             }, $this->selfClosingTags),
636 636
             '',
637 637
             $content
@@ -956,11 +956,11 @@  discard block
 block discarded – undo
956 956
 
957 957
             $html = (string) \preg_replace_callback(
958 958
                 '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
959
-                static function ($matches) {
960
-                    return $matches['start'] .
961
-                        '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
962
-                        $matches['value'] .
963
-                        '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
959
+                static function($matches) {
960
+                    return $matches['start'].
961
+                        '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
962
+                        $matches['value'].
963
+                        '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
964 964
                         $matches['end'];
965 965
                 },
966 966
                 $html
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 
973 973
             $html = (string) \preg_replace_callback(
974 974
                 '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
975
-                static function ($matches) {
975
+                static function($matches) {
976 976
                     $matches['broken'] = \str_replace(
977 977
                         ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
978 978
                         ['</', '<', '>'],
@@ -980,9 +980,9 @@  discard block
 block discarded – undo
980 980
                     );
981 981
 
982 982
                     self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
983
-                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']);
983
+                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']);
984 984
 
985
-                    return $matches['start'] . $matchesHash . $matches['end'];
985
+                    return $matches['start'].$matchesHash.$matches['end'];
986 986
                 },
987 987
                 $html
988 988
             );
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
     {
1005 1005
         // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>]
1006 1006
         $tags = \implode('|', \array_map(
1007
-            static function ($value) {
1007
+            static function($value) {
1008 1008
                 return \preg_quote($value, '/');
1009 1009
             },
1010 1010
             $this->specialScriptTags
1011 1011
         ));
1012 1012
         $html = (string) \preg_replace_callback(
1013
-            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:' . $tags . ')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1014
-            function ($matches) {
1013
+            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:'.$tags.')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1014
+            function($matches) {
1015 1015
 
1016 1016
                 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
1017 1017
                 // because often this looks like non valid html in the template itself.
@@ -1021,18 +1021,18 @@  discard block
 block discarded – undo
1021 1021
                         $matches['innerContent'] = \str_replace('<\/', '</', $matches['innerContent']);
1022 1022
 
1023 1023
                         self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent'];
1024
-                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '' . self::$domHtmlBrokenHtmlHelper . '' . \crc32($matches['innerContent']);
1024
+                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = ''.self::$domHtmlBrokenHtmlHelper.''.\crc32($matches['innerContent']);
1025 1025
 
1026
-                        return $matches['start'] . $matchesHash . $matches['end'];
1026
+                        return $matches['start'].$matchesHash.$matches['end'];
1027 1027
                     }
1028 1028
                 }
1029 1029
 
1030 1030
                 // remove the html5 fallback
1031 1031
                 $matches[0] = \str_replace('<\/', '</', $matches[0]);
1032 1032
 
1033
-                $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script'));
1033
+                $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script'));
1034 1034
 
1035
-                return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>';
1035
+                return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>';
1036 1036
             },
1037 1037
             $html
1038 1038
         );
Please login to merge, or discard this patch.