Completed
Pull Request — master (#55)
by Volodymyr
01:53
created
src/voku/helper/HtmlDomParser.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments);
167 167
         }
168 168
 
169
-        throw new \BadMethodCallException('Method does not exist: ' . $name);
169
+        throw new \BadMethodCallException('Method does not exist: '.$name);
170 170
     }
171 171
 
172 172
     /**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
             ||
353 353
             $this->keepBrokenHtml
354 354
         ) {
355
-            $html = '<' . self::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>';
355
+            $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>';
356 356
         }
357 357
 
358 358
         $html = self::replaceToPreserveHtmlEntities($html);
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             /** @noinspection StringFragmentMisplacedInspection */
375 375
             if (\stripos('<?xml', $html) !== 0) {
376 376
                 $xmlHackUsed = true;
377
-                $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
377
+                $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
378 378
             }
379 379
 
380 380
             $this->document->loadHTML($html, $optionsXml);
@@ -907,11 +907,11 @@  discard block
 block discarded – undo
907 907
 
908 908
             $html = (string) \preg_replace_callback(
909 909
                 '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
910
-                static function ($matches) {
911
-                    return $matches['start'] .
912
-                        '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
913
-                        $matches['value'] .
914
-                        '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
910
+                static function($matches) {
911
+                    return $matches['start'].
912
+                        '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
913
+                        $matches['value'].
914
+                        '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
915 915
                         $matches['end'];
916 916
                 },
917 917
                 $html
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 
924 924
             $html = (string) \preg_replace_callback(
925 925
                 '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
926
-                static function ($matches) {
926
+                static function($matches) {
927 927
                     $matches['broken'] = \str_replace(
928 928
                         ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
929 929
                         ['</', '<', '>'],
@@ -931,9 +931,9 @@  discard block
 block discarded – undo
931 931
                     );
932 932
 
933 933
                     self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
934
-                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']);
934
+                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']);
935 935
 
936
-                    return $matches['start'] . $matchesHash . $matches['end'];
936
+                    return $matches['start'].$matchesHash.$matches['end'];
937 937
                 },
938 938
                 $html
939 939
             );
@@ -955,8 +955,8 @@  discard block
 block discarded – undo
955 955
     {
956 956
         // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>]
957 957
         $html = (string) \preg_replace_callback(
958
-            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:' . implode('|', $this->specialScriptTags) . ')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
959
-            function ($matches) {
958
+            '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:'.implode('|', $this->specialScriptTags).')+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
959
+            function($matches) {
960 960
 
961 961
                 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
962 962
                 // because often this looks like non valid html in the template itself.
@@ -966,18 +966,18 @@  discard block
 block discarded – undo
966 966
                         $matches['innerContent'] = \str_replace('<\/', '</', $matches['innerContent']);
967 967
 
968 968
                         self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent'];
969
-                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '' . self::$domHtmlBrokenHtmlHelper . '' . \crc32($matches['innerContent']);
969
+                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = ''.self::$domHtmlBrokenHtmlHelper.''.\crc32($matches['innerContent']);
970 970
 
971
-                        return $matches['start'] . $matchesHash . $matches['end'];
971
+                        return $matches['start'].$matchesHash.$matches['end'];
972 972
                     }
973 973
                 }
974 974
 
975 975
                 // remove the html5 fallback
976 976
                 $matches[0] = \str_replace('<\/', '</', $matches[0]);
977 977
 
978
-                $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script'));
978
+                $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script'));
979 979
 
980
-                return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>';
980
+                return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>';
981 981
             },
982 982
             $html
983 983
         );
Please login to merge, or discard this patch.