Completed
Push — master ( eed633...d1f2b9 )
by Lars
01:46
created
src/voku/helper/HtmlDomParser.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -535,10 +535,10 @@
 block discarded – undo
535 535
                 '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
536 536
                 static function ($matches) {
537 537
                     return $matches['start'] .
538
-                           '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
539
-                           $matches['value'] .
540
-                           '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
541
-                           $matches['end'];
538
+                            '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
539
+                            $matches['value'] .
540
+                            '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
541
+                            $matches['end'];
542 542
                 },
543 543
                 $html
544 544
             );
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments);
147 147
         }
148 148
 
149
-        throw new \BadMethodCallException('Method does not exist: ' . $name);
149
+        throw new \BadMethodCallException('Method does not exist: '.$name);
150 150
     }
151 151
 
152 152
     /**
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             ||
343 343
             $this->keepBrokenHtml
344 344
         ) {
345
-            $html = '<' . self::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>';
345
+            $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>';
346 346
         }
347 347
 
348 348
         $html = self::replaceToPreserveHtmlEntities($html);
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             /** @noinspection StringFragmentMisplacedInspection */
365 365
             if (\stripos('<?xml', $html) !== 0) {
366 366
                 $xmlHackUsed = true;
367
-                $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
367
+                $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
368 368
             }
369 369
 
370 370
             $this->document->loadHTML($html, $optionsXml);
@@ -897,11 +897,11 @@  discard block
 block discarded – undo
897 897
 
898 898
             $html = (string) \preg_replace_callback(
899 899
                 '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
900
-                static function ($matches) {
901
-                    return $matches['start'] .
902
-                           '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
903
-                           $matches['value'] .
904
-                           '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
900
+                static function($matches) {
901
+                    return $matches['start'].
902
+                           '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
903
+                           $matches['value'].
904
+                           '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
905 905
                            $matches['end'];
906 906
                 },
907 907
                 $html
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 
914 914
             $html = (string) \preg_replace_callback(
915 915
                 '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
916
-                static function ($matches) {
916
+                static function($matches) {
917 917
                     $matches['broken'] = \str_replace(
918 918
                         ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
919 919
                         ['</', '<', '>'],
@@ -921,9 +921,9 @@  discard block
 block discarded – undo
921 921
                     );
922 922
 
923 923
                     self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
924
-                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']);
924
+                    self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']);
925 925
 
926
-                    return $matches['start'] . $matchesHash . $matches['end'];
926
+                    return $matches['start'].$matchesHash.$matches['end'];
927 927
                 },
928 928
                 $html
929 929
             );
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
         // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>]
947 947
         $html = (string) \preg_replace_callback(
948 948
             '/(?<start>((?:<script) [^>]*type=(?:["\'])?(?:text\/html|text\/x-custom-template)+(?:[^>]*)>))(?<innerContent>.*)(?<end><\/script>)/isU',
949
-            function ($matches) {
949
+            function($matches) {
950 950
 
951 951
                 // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>],
952 952
                 // because often this looks like non valid html in the template itself.
@@ -956,18 +956,18 @@  discard block
 block discarded – undo
956 956
                         $matches['innerContent'] = \str_replace('<\/', '</', $matches['innerContent']);
957 957
 
958 958
                         self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent'];
959
-                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '' . self::$domHtmlBrokenHtmlHelper . '' . \crc32($matches['innerContent']);
959
+                        self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = ''.self::$domHtmlBrokenHtmlHelper.''.\crc32($matches['innerContent']);
960 960
 
961
-                        return $matches['start'] . $matchesHash . $matches['end'];
961
+                        return $matches['start'].$matchesHash.$matches['end'];
962 962
                     }
963 963
                 }
964 964
 
965 965
                 // remove the html5 fallback
966 966
                 $matches[0] = \str_replace('<\/', '</', $matches[0]);
967 967
 
968
-                $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script'));
968
+                $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script'));
969 969
 
970
-                return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>';
970
+                return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>';
971 971
             },
972 972
             $html
973 973
         );
Please login to merge, or discard this patch.
src/voku/helper/SimpleHtmlDom.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
             $tmpStr = $this->normalizeStringForComparision($string);
418 418
             if ($tmpDomString !== $tmpStr) {
419 419
                 throw new \RuntimeException(
420
-                    'Not valid HTML fragment!' . "\n" .
421
-                    $tmpDomString . "\n" .
420
+                    'Not valid HTML fragment!'."\n".
421
+                    $tmpDomString."\n".
422 422
                     $tmpStr
423 423
                 );
424 424
             }
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
         $tmpStr = $this->normalizeStringForComparision($string);
491 491
         if ($tmpDomOuterTextString !== $tmpStr) {
492 492
             throw new \RuntimeException(
493
-                'Not valid HTML fragment!' . "\n"
494
-                . $tmpDomOuterTextString . "\n" .
493
+                'Not valid HTML fragment!'."\n"
494
+                . $tmpDomOuterTextString."\n".
495 495
                 $tmpStr
496 496
             );
497 497
         }
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     /**
445 445
      * Returns the first child of node.
446 446
      *
447
-     * @return SimpleHtmlDomInterface|null
447
+     * @return null|SimpleHtmlDom
448 448
      */
449 449
     public function firstChild()
450 450
     {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     /**
591 591
      * Returns the last child of node.
592 592
      *
593
-     * @return SimpleHtmlDomInterface|null
593
+     * @return null|SimpleHtmlDom
594 594
      */
595 595
     public function lastChild()
596 596
     {
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
     /**
608 608
      * Returns the next sibling of node.
609 609
      *
610
-     * @return SimpleHtmlDomInterface|null
610
+     * @return null|SimpleHtmlDom
611 611
      */
612 612
     public function nextSibling()
613 613
     {
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
     /**
625 625
      * Returns the next sibling of node.
626 626
      *
627
-     * @return SimpleHtmlDomInterface|null
627
+     * @return null|SimpleHtmlDom
628 628
      */
629 629
     public function nextNonWhitespaceSibling()
630 630
     {
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
     /**
657 657
      * Returns the previous sibling of node.
658 658
      *
659
-     * @return SimpleHtmlDomInterface|null
659
+     * @return null|SimpleHtmlDom
660 660
      */
661 661
     public function previousSibling()
662 662
     {
Please login to merge, or discard this patch.
src/voku/helper/SimpleXmlDom.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
             $tmpStr = $this->normalizeStringForComparision($string);
418 418
             if ($tmpDomString !== $tmpStr) {
419 419
                 throw new \RuntimeException(
420
-                    'Not valid HTML fragment!' . "\n" .
421
-                    $tmpDomString . "\n" .
420
+                    'Not valid HTML fragment!'."\n".
421
+                    $tmpDomString."\n".
422 422
                     $tmpStr
423 423
                 );
424 424
             }
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
         $tmpStr = $this->normalizeStringForComparision($string);
491 491
         if ($tmpDomOuterTextString !== $tmpStr) {
492 492
             throw new \RuntimeException(
493
-                'Not valid HTML fragment!' . "\n"
494
-                . $tmpDomOuterTextString . "\n" .
493
+                'Not valid HTML fragment!'."\n"
494
+                . $tmpDomOuterTextString."\n".
495 495
                 $tmpStr
496 496
             );
497 497
         }
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     /**
419 419
      * Returns the first child of node.
420 420
      *
421
-     * @return SimpleXmlDomInterface|null
421
+     * @return null|SimpleXmlDom
422 422
      */
423 423
     public function firstChild()
424 424
     {
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
     /**
577 577
      * Returns the last child of node.
578 578
      *
579
-     * @return SimpleXmlDomInterface|null
579
+     * @return null|SimpleXmlDom
580 580
      */
581 581
     public function lastChild()
582 582
     {
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
     /**
594 594
      * Returns the next sibling of node.
595 595
      *
596
-     * @return SimpleXmlDomInterface|null
596
+     * @return null|SimpleXmlDom
597 597
      */
598 598
     public function nextSibling()
599 599
     {
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
     /**
611 611
      * Returns the next sibling of node.
612 612
      *
613
-     * @return SimpleXmlDomInterface|null
613
+     * @return null|SimpleXmlDom
614 614
      */
615 615
     public function nextNonWhitespaceSibling()
616 616
     {
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
     /**
643 643
      * Returns the previous sibling of node.
644 644
      *
645
-     * @return SimpleXmlDomInterface|null
645
+     * @return null|SimpleXmlDom
646 646
      */
647 647
     public function previousSibling()
648 648
     {
Please login to merge, or discard this patch.
src/voku/helper/XmlDomParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
             /** @noinspection StringFragmentMisplacedInspection */
152 152
             if (\stripos('<?xml', $xml) !== 0) {
153 153
                 $xmlHackUsed = true;
154
-                $xml = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $xml;
154
+                $xml = '<?xml encoding="'.$this->getEncoding().'" ?>'.$xml;
155 155
             }
156 156
 
157 157
             $this->document->loadXML($xml, $optionsXml);
Please login to merge, or discard this patch.
src/voku/helper/AbstractDomParser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments);
84 84
         }
85 85
 
86
-        throw new \BadMethodCallException('Method does not exist: ' . $name);
86
+        throw new \BadMethodCallException('Method does not exist: '.$name);
87 87
     }
88 88
 
89 89
     /**
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
         $regExSpecialScript = '/<(script)(?<attr>[^>]*)>(?<content>.*)<\/\1>/isU';
390 390
         $htmlTmp = \preg_replace_callback(
391 391
             $regExSpecialScript,
392
-            static function ($scripts) {
392
+            static function($scripts) {
393 393
                 if (empty($scripts['content'])) {
394 394
                     return $scripts[0];
395 395
                 }
396 396
 
397
-                return '<script' . $scripts['attr'] . '>' . \str_replace('</', '<\/', $scripts['content']) . '</script>';
397
+                return '<script'.$scripts['attr'].'>'.\str_replace('</', '<\/', $scripts['content']).'</script>';
398 398
             },
399 399
             $html
400 400
         );
@@ -423,14 +423,14 @@  discard block
 block discarded – undo
423 423
                 self::$domReplaceHelper['orig']
424 424
             );
425 425
 
426
-            $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>';
427
-            $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>';
426
+            $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<'.self::$domHtmlWrapperHelper.'>';
427
+            $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</'.self::$domHtmlWrapperHelper.'>';
428 428
 
429 429
             $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = '';
430 430
             $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = '';
431 431
 
432
-            $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper;
433
-            $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>';
432
+            $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<'.self::$domHtmlSpecialScriptHelper;
433
+            $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</'.self::$domHtmlSpecialScriptHelper.'>';
434 434
 
435 435
             $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script';
436 436
             $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>';
Please login to merge, or discard this patch.
src/voku/helper/SimpleHtmlAttributes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
             return (string) $this;
66 66
         }
67 67
 
68
-        throw new \InvalidArgumentException('Undefined property: $' . $name);
68
+        throw new \InvalidArgumentException('Undefined property: $'.$name);
69 69
     }
70 70
 
71 71
     /**
Please login to merge, or discard this patch.
example/example_find_text.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,5 +41,5 @@
 block discarded – undo
41 41
 $document = new \voku\helper\HtmlDomParser($html);
42 42
 
43 43
 foreach (find_contains($document, '.lall', 'foo') as $child_dom) {
44
-    echo $child_dom->html() . "\n";
44
+    echo $child_dom->html()."\n";
45 45
 }
Please login to merge, or discard this patch.
example/example_scraping_imdb.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
 $data = scraping_imdb('http://imdb.com/title/tt0335266/');
25 25
 
26 26
 foreach ($data as $k => $v) {
27
-    echo '<strong>' . $k . ' </strong>' . $v . '<br>';
27
+    echo '<strong>'.$k.' </strong>'.$v.'<br>';
28 28
 }
Please login to merge, or discard this patch.
example/example_scraping_lebensmittelwarnung.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,6 +34,6 @@
 block discarded – undo
34 34
 
35 35
 foreach ($data as $v) {
36 36
     foreach ($v as $k_inner => $v_inner) {
37
-        echo '<strong>' . $k_inner . ':</strong>&nbsp;' . $v_inner . '<br><br>';
37
+        echo '<strong>'.$k_inner.':</strong>&nbsp;'.$v_inner.'<br><br>';
38 38
     }
39 39
 }
Please login to merge, or discard this patch.