Completed
Push — master ( ae518a...b71ea1 )
by Lars
01:46
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
         );
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                 $this->keepBrokenHtml
411 411
             )
412 412
         ) {
413
-            $html = '<' . self::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>';
413
+            $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>';
414 414
         }
415 415
 
416 416
         $html = self::replaceToPreserveHtmlEntities($html);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             /** @noinspection StringFragmentMisplacedInspection */
437 437
             if (\stripos('<?xml', $html) !== 0) {
438 438
                 $xmlHackUsed = true;
439
-                $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
439
+                $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
440 440
             }
441 441
 
442 442
             $this->document->loadHTML($html, $optionsXml);
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 
648 648
         // https://bugs.php.net/bug.php?id=73175
649 649
         $content = \str_replace(
650
-            \array_map(static function ($e) {
651
-                return '</' . $e . '>';
650
+            \array_map(static function($e) {
651
+                return '</'.$e.'>';
652 652
             }, $this->selfClosingTags),
653 653
             '',
654 654
             $content
@@ -973,11 +973,11 @@  discard block
 block discarded – undo
973 973
 
974 974
             $html = (string) \preg_replace_callback(
975 975
                 '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
976
-                static function ($matches) {
977
-                    return $matches['start'] .
978
-                        '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
979
-                        $matches['value'] .
980
-                        '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
976
+                static function($matches) {
977
+                    return $matches['start'].
978
+                        '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
979
+                        $matches['value'].
980
+                        '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
981 981
                         $matches['end'];
982 982
                 },
983 983
                 $html
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 
990 990
             $html = (string) \preg_replace_callback(
991 991
                 '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
992
-                static function ($matches) {
992
+                static function($matches) {
993 993
                     $matches['broken'] = \str_replace(
994 994
                         ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
995 995
                         ['</', '<', '>'],
@@ -997,9 +997,9 @@  discard block
 block discarded – undo
997 997
                     );
998 998
 
999 999
                     self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
1000
-                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']);
1000
+                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']);
1001 1001
 
1002
-                    return $matches['start'] . $matchesHash . $matches['end'];
1002
+                    return $matches['start'].$matchesHash.$matches['end'];
1003 1003
                 },
1004 1004
                 $html
1005 1005
             );
@@ -1021,14 +1021,14 @@  discard block
 block discarded – undo
1021 1021
     {
1022 1022
         // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>]
1023 1023
         $tags = \implode('|', \array_map(
1024
-            static function ($value) {
1024
+            static function($value) {
1025 1025
                 return \preg_quote($value, '/');
1026 1026
             },
1027 1027
             $this->specialScriptTags
1028 1028
         ));
1029 1029
         $html = (string) \preg_replace_callback(
1030
-            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:' . $tags . ')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1031
-            function ($matches) {
1030
+            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:'.$tags.')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
1031
+            function($matches) {
1032 1032
 
1033 1033
                 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
1034 1034
                 // because often this looks like non valid html in the template itself.
@@ -1038,18 +1038,18 @@  discard block
 block discarded – undo
1038 1038
                         $matches['innerContent'] = \str_replace('<\/', '</', $matches['innerContent']);
1039 1039
 
1040 1040
                         self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent'];
1041
-                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '' . self::$domHtmlBrokenHtmlHelper . '' . \crc32($matches['innerContent']);
1041
+                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = ''.self::$domHtmlBrokenHtmlHelper.''.\crc32($matches['innerContent']);
1042 1042
 
1043
-                        return $matches['start'] . $matchesHash . $matches['end'];
1043
+                        return $matches['start'].$matchesHash.$matches['end'];
1044 1044
                     }
1045 1045
                 }
1046 1046
 
1047 1047
                 // remove the html5 fallback
1048 1048
                 $matches[0] = \str_replace('<\/', '</', $matches[0]);
1049 1049
 
1050
-                $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script'));
1050
+                $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script'));
1051 1051
 
1052
-                return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>';
1052
+                return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>';
1053 1053
             },
1054 1054
             $html
1055 1055
         );
Please login to merge, or discard this patch.