@@ -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; |
@@ -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____', |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ |
| 161 | - throw new BadMethodCallException('Method does not exist: ' . $name); |
|
| 161 | + throw new BadMethodCallException('Method does not exist: '.$name); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | if (!empty($linksOld[1])) { |
| 277 | 277 | $linksOld = $linksOld[1]; |
| 278 | - foreach ((array)$linksOld as $linkKey => $linkOld) { |
|
| 278 | + foreach ((array) $linksOld as $linkKey => $linkOld) { |
|
| 279 | 279 | $linksNew[$linkKey] = \str_replace( |
| 280 | 280 | self::$domLinkReplaceHelper['orig'], |
| 281 | 281 | self::$domLinkReplaceHelper['tmp'], |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $xmlHackUsed = false; |
| 378 | 378 | if (\stripos('<?xml', $html) !== 0) { |
| 379 | 379 | $xmlHackUsed = true; |
| 380 | - $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html; |
|
| 380 | + $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $html = self::replaceToPreserveHtmlEntities($html); |
@@ -566,8 +566,8 @@ discard block |
||
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | if ($this->isDOMDocumentCreatedWithoutWrapper === true) { |
| 569 | - $content = (string)\preg_replace('/^<p>/', '', $content); |
|
| 570 | - $content = (string)\preg_replace('/<\/p>/', '', $content); |
|
| 569 | + $content = (string) \preg_replace('/^<p>/', '', $content); |
|
| 570 | + $content = (string) \preg_replace('/<\/p>/', '', $content); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | if ($this->isDOMDocumentCreatedWithoutHtml === true) { |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | $xml = $this->document->saveXML(null, LIBXML_NOEMPTYTAG); |
| 723 | 723 | |
| 724 | 724 | // remove the XML-header |
| 725 | - $xml = \ltrim((string)\preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
| 725 | + $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
| 726 | 726 | |
| 727 | 727 | return $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
| 728 | 728 | } |
@@ -580,7 +580,7 @@ |
||
| 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 |