@@ -15,7 +15,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -9,36 +9,36 @@ |
||
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; |
@@ -701,7 +701,7 @@ |
||
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 | { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\helper; |
6 | 6 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $string = str_replace(array('<head>', '</head>'), '', $string); |
568 | 568 | } |
569 | 569 | } else { |
570 | - $string = (string)$input; |
|
570 | + $string = (string) $input; |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | return |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\helper; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\helper; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\helper; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\helper; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace voku\helper; |
6 | 6 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @var string[][] |
52 | 52 | */ |
53 | 53 | protected static $domLinkReplaceHelper = [ |
54 | - 'orig' => ['[', ']', '{', '}',], |
|
54 | + 'orig' => ['[', ']', '{', '}', ], |
|
55 | 55 | 'tmp' => [ |
56 | 56 | '!!!!SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_LEFT!!!!', |
57 | 57 | '!!!!SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_RIGHT!!!!', |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ |
160 | - throw new BadMethodCallException('Method does not exist: ' . $name); |
|
160 | + throw new BadMethodCallException('Method does not exist: '.$name); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | if (!empty($linksOld[1])) { |
276 | 276 | $linksOld = $linksOld[1]; |
277 | - foreach ((array)$linksOld as $linkKey => $linkOld) { |
|
277 | + foreach ((array) $linksOld as $linkKey => $linkOld) { |
|
278 | 278 | $linksNew[$linkKey] = \str_replace( |
279 | 279 | self::$domLinkReplaceHelper['orig'], |
280 | 280 | self::$domLinkReplaceHelper['tmp'], |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $xmlHackUsed = false; |
383 | 383 | if (\stripos('<?xml', $html) !== 0) { |
384 | 384 | $xmlHackUsed = true; |
385 | - $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html; |
|
385 | + $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | $html = self::replaceToPreserveHtmlEntities($html); |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | } |
560 | 560 | |
561 | 561 | if ($this->isDOMDocumentCreatedWithoutWrapper === true) { |
562 | - $content = (string)\preg_replace('/^<p>/', '', $content); |
|
563 | - $content = (string)\preg_replace('/<\/p>/', '', $content); |
|
562 | + $content = (string) \preg_replace('/^<p>/', '', $content); |
|
563 | + $content = (string) \preg_replace('/<\/p>/', '', $content); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | if ($this->isDOMDocumentCreatedWithoutHtml === true) { |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | $xml = $this->document->saveXML(null, LIBXML_NOEMPTYTAG); |
714 | 714 | |
715 | 715 | // remove the XML-header |
716 | - $xml = \ltrim((string)\preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
716 | + $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
717 | 717 | |
718 | 718 | return $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
719 | 719 | } |