Completed
Push — master ( 475fcb...468717 )
by Lars
02:16 queued 43s
created
example/example_advanced_selector.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 HTML;
16 16
 
17 17
 $html = HtmlDomParser::str_get_html($str);
18
-echo $html->find('div div div', 0)->innertext . '<br>'; // result: "ok"
18
+echo $html->find('div div div', 0)->innertext.'<br>'; // result: "ok"
19 19
 
20 20
 // -----------------------------------------------------------------------------
21 21
 // nested selector
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 $html = HtmlDomParser::str_get_html($str);
34 34
 foreach ($html->find('ul') as $ul) {
35 35
   foreach ($ul->find('li') as $li) {
36
-    echo $li->innertext . '<br>';
36
+    echo $li->innertext.'<br>';
37 37
   }
38 38
 }
39 39
 
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 $html = HtmlDomParser::str_get_html($str);
51 51
 foreach ($html->find('input[type=checkbox]') as $checkbox) {
52 52
   if ($checkbox->checked) {
53
-    echo $checkbox->name . ' is checked<br>';
53
+    echo $checkbox->name.' is checked<br>';
54 54
   } else {
55
-    echo $checkbox->name . ' is not checked<br>';
55
+    echo $checkbox->name.' is not checked<br>';
56 56
   }
57 57
 }
Please login to merge, or discard this patch.
example/example_basic_selector.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,36 +9,36 @@
 block discarded – undo
9 9
 
10 10
 // find all link
11 11
 foreach ($html->find('a') as $e) {
12
-  echo $e->href . '<br>';
12
+  echo $e->href.'<br>';
13 13
 }
14 14
 
15 15
 // find all image
16 16
 foreach ($html->find('img') as $e) {
17
-  echo $e->src . '<br>';
17
+  echo $e->src.'<br>';
18 18
 }
19 19
 
20 20
 // find all image with full tag
21 21
 foreach ($html->find('img') as $e) {
22
-  echo $e->outertext . '<br>';
22
+  echo $e->outertext.'<br>';
23 23
 }
24 24
 
25 25
 // find all div tags with id=gbar
26 26
 foreach ($html->find('div#gbar') as $e) {
27
-  echo $e->innertext . '<br>';
27
+  echo $e->innertext.'<br>';
28 28
 }
29 29
 
30 30
 // find all span tags with class=gb1
31 31
 foreach ($html->find('span.gb1') as $e) {
32
-  echo $e->outertext . '<br>';
32
+  echo $e->outertext.'<br>';
33 33
 }
34 34
 
35 35
 // find all td tags with attribite align=center
36 36
 foreach ($html->find('td[align=center]') as $e) {
37
-  echo $e->innertext . '<br>';
37
+  echo $e->innertext.'<br>';
38 38
 }
39 39
 
40 40
 // extract text from table
41
-echo $html->find('td[align="center"]', 1)->plaintext . '<br><hr>';
41
+echo $html->find('td[align="center"]', 1)->plaintext.'<br><hr>';
42 42
 
43 43
 // extract text from HTML
44 44
 echo $html->plaintext;
Please login to merge, or discard this patch.
src/voku/helper/SimpleHtmlDom.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -701,7 +701,7 @@
 block discarded – undo
701 701
    *
702 702
    * @param string $name <p>The name of the html-attribute.</p>
703 703
    *
704
-   * @return mixed
704
+   * @return SimpleHtmlDom
705 705
    */
706 706
   public function removeAttribute(string $name)
707 707
   {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -580,7 +580,7 @@
 block discarded – undo
580 580
         $string = \str_replace(['<head>', '</head>'], '', $string);
581 581
       }
582 582
     } else {
583
-      $string = (string)$input;
583
+      $string = (string) $input;
584 584
     }
585 585
 
586 586
     return
Please login to merge, or discard this patch.
src/voku/helper/HtmlDomParser.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -442,10 +442,10 @@
 block discarded – undo
442 442
           '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
443 443
           function ($matches) {
444 444
             return $matches['start'] .
445
-                   '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
446
-                   $matches['value'] .
447
-                   '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
448
-                   $matches['end'];
445
+                    '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
446
+                    $matches['value'] .
447
+                    '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
448
+                    $matches['end'];
449 449
           },
450 450
           $html
451 451
       );
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
    * @var string[][]
46 46
    */
47 47
   protected static $domLinkReplaceHelper = [
48
-      'orig' => ['[', ']', '{', '}',],
48
+      'orig' => ['[', ']', '{', '}', ],
49 49
       'tmp'  => [
50 50
           '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_LEFT____',
51 51
           '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_RIGHT____',
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
       return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments);
165 165
     }
166 166
 
167
-    throw new \BadMethodCallException('Method does not exist: ' . $name);
167
+    throw new \BadMethodCallException('Method does not exist: '.$name);
168 168
   }
169 169
 
170 170
   /**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
       if (!empty($linksOld[1])) {
281 281
         $linksOld = $linksOld[1];
282
-        foreach ((array)$linksOld as $linkKey => $linkOld) {
282
+        foreach ((array) $linksOld as $linkKey => $linkOld) {
283 283
           $linksNew[$linkKey] = \str_replace(
284 284
               self::$domLinkReplaceHelper['orig'],
285 285
               self::$domLinkReplaceHelper['tmp'],
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
       $xmlHackUsed = false;
397 397
       if (\stripos('<?xml', $html) !== 0) {
398 398
         $xmlHackUsed = true;
399
-        $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html;
399
+        $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html;
400 400
       }
401 401
 
402 402
       $html = self::replaceToPreserveHtmlEntities($html);
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
     do {
439 439
       $original = $html;
440 440
 
441
-      $html = (string)preg_replace_callback(
441
+      $html = (string) preg_replace_callback(
442 442
           '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui',
443
-          function ($matches) {
444
-            return $matches['start'] .
445
-                   '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' .
446
-                   $matches['value'] .
447
-                   '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' .
443
+          function($matches) {
444
+            return $matches['start'].
445
+                   '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'.
446
+                   $matches['value'].
447
+                   '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'.
448 448
                    $matches['end'];
449 449
           },
450 450
           $html
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
     do {
459 459
       $original = $html;
460 460
 
461
-      $html = (string)preg_replace_callback(
461
+      $html = (string) preg_replace_callback(
462 462
           '/(?<start>[^<]*)?(?<broken>(?:(?:<\/\w+(?:\s+\w+=\\"[^\"]+\\")*+)(?:[^<]+)>)+)(?<end>.*)/u',
463
-          function ($matches) {
463
+          function($matches) {
464 464
 
465 465
             $matches['broken'] = str_replace(
466 466
                 ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'],
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
             //var_dump($matches['broken']);
472 472
 
473 473
             self::$domBrokenReplaceHelper['orig'][] = $matches['broken'];
474
-            self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '____simple_html_dom__voku__broken_html____' . crc32($matches['broken']);
474
+            self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = '____simple_html_dom__voku__broken_html____'.crc32($matches['broken']);
475 475
 
476
-            return $matches['start'] . $matchesHash . $matches['end'];
476
+            return $matches['start'].$matchesHash.$matches['end'];
477 477
           },
478 478
           $html
479 479
       );
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     );
491 491
 
492 492
     if ($backup !== $html) {
493
-      $html = '<____simple_html_dom__voku__broken_html_wrapper____>' . $html . '</____simple_html_dom__voku__broken_html_wrapper____>';
493
+      $html = '<____simple_html_dom__voku__broken_html_wrapper____>'.$html.'</____simple_html_dom__voku__broken_html_wrapper____>';
494 494
     }
495 495
 
496 496
     return $html;
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
     }
667 667
 
668 668
     if ($this->isDOMDocumentCreatedWithoutWrapper === true) {
669
-      $content = (string)\preg_replace('/^<p>/', '', $content);
670
-      $content = (string)\preg_replace('/<\/p>/', '', $content);
669
+      $content = (string) \preg_replace('/^<p>/', '', $content);
670
+      $content = (string) \preg_replace('/<\/p>/', '', $content);
671 671
     }
672 672
 
673 673
     if ($this->isDOMDocumentCreatedWithoutHtml === true) {
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
     $xml = $this->document->saveXML(null, \LIBXML_NOEMPTYTAG);
838 838
 
839 839
     // remove the XML-header
840
-    $xml = \ltrim((string)\preg_replace('/<\?xml.*\?>/', '', $xml));
840
+    $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
841 841
 
842 842
     return $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
843 843
   }
Please login to merge, or discard this patch.