| @@ -572,7 +572,7 @@ discard block | ||
| 572 | 572 | $attr_val = $attribute->value; | 
| 573 | 573 | } | 
| 574 | 574 | |
| 575 | - $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp); | |
| 575 | + $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp); | |
| 576 | 576 | $attr_str .= ' '; | 
| 577 | 577 | } | 
| 578 | 578 | } | 
| @@ -869,21 +869,21 @@ discard block | ||
| 869 | 869 | $tmpTypePublic = 'PUBLIC'; | 
| 870 | 870 | } | 
| 871 | 871 | |
| 872 | - $html .= '<!DOCTYPE ' . $child->name . '' | |
| 873 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') | |
| 874 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') | |
| 872 | + $html .= '<!DOCTYPE '.$child->name.'' | |
| 873 | + . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '') | |
| 874 | + . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '') | |
| 875 | 875 | . '>'; | 
| 876 | 876 | } | 
| 877 | 877 |              } elseif ($child instanceof \DOMElement) { | 
| 878 | -                $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); | |
| 879 | - $html .= '>' . $this->domNodeToString($child); | |
| 878 | +                $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); | |
| 879 | + $html .= '>'.$this->domNodeToString($child); | |
| 880 | 880 | |
| 881 | 881 | if ( | 
| 882 | 882 | !$this->doRemoveOmittedHtmlTags | 
| 883 | 883 | || | 
| 884 | 884 | !$this->domNodeClosingTagOptional($child) | 
| 885 | 885 |                  ) { | 
| 886 | - $html .= '</' . $child->tagName . '>'; | |
| 886 | + $html .= '</'.$child->tagName.'>'; | |
| 887 | 887 | } | 
| 888 | 888 | |
| 889 | 889 |                  if (!$this->doRemoveWhitespaceAroundTags) { | 
| @@ -947,7 +947,7 @@ discard block | ||
| 947 | 947 | $html .= $child->wholeText; | 
| 948 | 948 | } | 
| 949 | 949 |              } elseif ($child instanceof \DOMComment) { | 
| 950 | - $html .= '<!--' . $child->textContent . '-->'; | |
| 950 | + $html .= '<!--'.$child->textContent.'-->'; | |
| 951 | 951 | } | 
| 952 | 952 | } | 
| 953 | 953 | |
| @@ -1155,8 +1155,8 @@ discard block | ||
| 1155 | 1155 |          if (\strpos($html, ' ') !== false) { | 
| 1156 | 1156 | $html = (string) \preg_replace_callback( | 
| 1157 | 1157 | '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#', | 
| 1158 | -                static function ($matches) { | |
| 1159 | -                    return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; | |
| 1158 | +                static function($matches) { | |
| 1159 | +                    return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; | |
| 1160 | 1160 | }, | 
| 1161 | 1161 | $html | 
| 1162 | 1162 | ); | 
| @@ -1176,7 +1176,7 @@ discard block | ||
| 1176 | 1176 | |
| 1177 | 1177 |          if (\strpos($html, $this->protectedChildNodesHelper) !== false) { | 
| 1178 | 1178 | $html = (string) \preg_replace_callback( | 
| 1179 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', | |
| 1179 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', | |
| 1180 | 1180 | [$this, 'restoreProtectedHtml'], | 
| 1181 | 1181 | $html | 
| 1182 | 1182 | ); | 
| @@ -1196,14 +1196,14 @@ discard block | ||
| 1196 | 1196 | |
| 1197 | 1197 | $html = \str_replace( | 
| 1198 | 1198 | [ | 
| 1199 | - 'html>' . "\n", | |
| 1200 | - "\n" . '<html', | |
| 1201 | - 'html/>' . "\n", | |
| 1202 | - "\n" . '</html', | |
| 1203 | - 'head>' . "\n", | |
| 1204 | - "\n" . '<head', | |
| 1205 | - 'head/>' . "\n", | |
| 1206 | - "\n" . '</head', | |
| 1199 | + 'html>'."\n", | |
| 1200 | + "\n".'<html', | |
| 1201 | + 'html/>'."\n", | |
| 1202 | + "\n".'</html', | |
| 1203 | + 'head>'."\n", | |
| 1204 | + "\n".'<head', | |
| 1205 | + 'head/>'."\n", | |
| 1206 | + "\n".'</head', | |
| 1207 | 1207 | ], | 
| 1208 | 1208 | [ | 
| 1209 | 1209 | 'html>', | 
| @@ -1222,11 +1222,11 @@ discard block | ||
| 1222 | 1222 | $replace = []; | 
| 1223 | 1223 | $replacement = []; | 
| 1224 | 1224 |          foreach (self::$selfClosingTags as $selfClosingTag) { | 
| 1225 | - $replace[] = '<' . $selfClosingTag . '/>'; | |
| 1226 | - $replacement[] = '<' . $selfClosingTag . '>'; | |
| 1227 | - $replace[] = '<' . $selfClosingTag . ' />'; | |
| 1228 | - $replacement[] = '<' . $selfClosingTag . '>'; | |
| 1229 | - $replace[] = '></' . $selfClosingTag . '>'; | |
| 1225 | + $replace[] = '<'.$selfClosingTag.'/>'; | |
| 1226 | + $replacement[] = '<'.$selfClosingTag.'>'; | |
| 1227 | + $replace[] = '<'.$selfClosingTag.' />'; | |
| 1228 | + $replacement[] = '<'.$selfClosingTag.'>'; | |
| 1229 | + $replace[] = '></'.$selfClosingTag.'>'; | |
| 1230 | 1230 | $replacement[] = '>'; | 
| 1231 | 1231 | } | 
| 1232 | 1232 | $html = \str_replace( | 
| @@ -1417,7 +1417,7 @@ discard block | ||
| 1417 | 1417 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml(); | 
| 1418 | 1418 | $parentNode = $element->getNode()->parentNode; | 
| 1419 | 1419 |              if ($parentNode !== null) { | 
| 1420 | - $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; | |
| 1420 | + $parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; | |
| 1421 | 1421 | } | 
| 1422 | 1422 | |
| 1423 | 1423 | ++$this->protected_tags_counter; | 
| @@ -1451,7 +1451,7 @@ discard block | ||
| 1451 | 1451 | } | 
| 1452 | 1452 | |
| 1453 | 1453 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml; | 
| 1454 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; | |
| 1454 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; | |
| 1455 | 1455 | |
| 1456 | 1456 | ++$this->protected_tags_counter; | 
| 1457 | 1457 | } | 
| @@ -1468,11 +1468,11 @@ discard block | ||
| 1468 | 1468 | continue; | 
| 1469 | 1469 | } | 
| 1470 | 1470 | |
| 1471 | - $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->'; | |
| 1471 | + $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->'; | |
| 1472 | 1472 | |
| 1473 | 1473 | /* @var $node \DOMComment */ | 
| 1474 | 1474 | $node = $element->getNode(); | 
| 1475 | -            $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'); | |
| 1475 | +            $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'); | |
| 1476 | 1476 | $parentNode = $element->getNode()->parentNode; | 
| 1477 | 1477 |              if ($parentNode !== null) { | 
| 1478 | 1478 | $parentNode->replaceChild($child, $node); | 
| @@ -689,220 +689,220 @@ discard block | ||
| 689 | 689 | return \in_array($tag_name, self::$optional_end_tags, true) | 
| 690 | 690 | || | 
| 691 | 691 | ( | 
| 692 | - $tag_name === 'li' | |
| 692 | + $tag_name === 'li' | |
| 693 | 693 | && | 
| 694 | 694 | ( | 
| 695 | - $nextSibling === null | |
| 695 | + $nextSibling === null | |
| 696 | 696 | || | 
| 697 | 697 | ( | 
| 698 | - $nextSibling instanceof \DOMElement | |
| 698 | + $nextSibling instanceof \DOMElement | |
| 699 | 699 | && | 
| 700 | 700 | $nextSibling->tagName === 'li' | 
| 701 | - ) | |
| 702 | - ) | |
| 703 | - ) | |
| 701 | + ) | |
| 702 | + ) | |
| 703 | + ) | |
| 704 | 704 | || | 
| 705 | 705 | ( | 
| 706 | - $tag_name === 'optgroup' | |
| 706 | + $tag_name === 'optgroup' | |
| 707 | 707 | && | 
| 708 | 708 | ( | 
| 709 | - $nextSibling === null | |
| 709 | + $nextSibling === null | |
| 710 | 710 | || | 
| 711 | 711 | ( | 
| 712 | - $nextSibling instanceof \DOMElement | |
| 712 | + $nextSibling instanceof \DOMElement | |
| 713 | 713 | && | 
| 714 | 714 | $nextSibling->tagName === 'optgroup' | 
| 715 | - ) | |
| 716 | - ) | |
| 717 | - ) | |
| 715 | + ) | |
| 716 | + ) | |
| 717 | + ) | |
| 718 | 718 | || | 
| 719 | 719 | ( | 
| 720 | - $tag_name === 'rp' | |
| 720 | + $tag_name === 'rp' | |
| 721 | 721 | && | 
| 722 | 722 | ( | 
| 723 | - $nextSibling === null | |
| 723 | + $nextSibling === null | |
| 724 | 724 | || | 
| 725 | 725 | ( | 
| 726 | - $nextSibling instanceof \DOMElement | |
| 726 | + $nextSibling instanceof \DOMElement | |
| 727 | 727 | && | 
| 728 | 728 | ( | 
| 729 | - $nextSibling->tagName === 'rp' | |
| 729 | + $nextSibling->tagName === 'rp' | |
| 730 | 730 | || | 
| 731 | 731 | $nextSibling->tagName === 'rt' | 
| 732 | - ) | |
| 733 | - ) | |
| 734 | - ) | |
| 735 | - ) | |
| 732 | + ) | |
| 733 | + ) | |
| 734 | + ) | |
| 735 | + ) | |
| 736 | 736 | || | 
| 737 | 737 | ( | 
| 738 | - $tag_name === 'tr' | |
| 738 | + $tag_name === 'tr' | |
| 739 | 739 | && | 
| 740 | 740 | ( | 
| 741 | - $nextSibling === null | |
| 741 | + $nextSibling === null | |
| 742 | 742 | || | 
| 743 | 743 | ( | 
| 744 | - $nextSibling instanceof \DOMElement | |
| 744 | + $nextSibling instanceof \DOMElement | |
| 745 | 745 | && | 
| 746 | 746 | $nextSibling->tagName === 'tr' | 
| 747 | - ) | |
| 748 | - ) | |
| 749 | - ) | |
| 747 | + ) | |
| 748 | + ) | |
| 749 | + ) | |
| 750 | 750 | || | 
| 751 | 751 | ( | 
| 752 | - $tag_name === 'source' | |
| 752 | + $tag_name === 'source' | |
| 753 | 753 | && | 
| 754 | 754 | ( | 
| 755 | - $parent_tag_name === 'audio' | |
| 755 | + $parent_tag_name === 'audio' | |
| 756 | 756 | || | 
| 757 | 757 | $parent_tag_name === 'video' | 
| 758 | 758 | || | 
| 759 | 759 | $parent_tag_name === 'picture' | 
| 760 | 760 | || | 
| 761 | 761 | $parent_tag_name === 'source' | 
| 762 | - ) | |
| 762 | + ) | |
| 763 | 763 | && | 
| 764 | 764 | ( | 
| 765 | - $nextSibling === null | |
| 765 | + $nextSibling === null | |
| 766 | 766 | || | 
| 767 | 767 | ( | 
| 768 | - $nextSibling instanceof \DOMElement | |
| 768 | + $nextSibling instanceof \DOMElement | |
| 769 | 769 | && | 
| 770 | 770 | $nextSibling->tagName === 'source' | 
| 771 | - ) | |
| 772 | - ) | |
| 773 | - ) | |
| 771 | + ) | |
| 772 | + ) | |
| 773 | + ) | |
| 774 | 774 | || | 
| 775 | 775 | ( | 
| 776 | - ( | |
| 777 | - $tag_name === 'td' | |
| 776 | + ( | |
| 777 | + $tag_name === 'td' | |
| 778 | 778 | || | 
| 779 | 779 | $tag_name === 'th' | 
| 780 | - ) | |
| 780 | + ) | |
| 781 | 781 | && | 
| 782 | 782 | ( | 
| 783 | - $nextSibling === null | |
| 783 | + $nextSibling === null | |
| 784 | 784 | || | 
| 785 | 785 | ( | 
| 786 | - $nextSibling instanceof \DOMElement | |
| 786 | + $nextSibling instanceof \DOMElement | |
| 787 | 787 | && | 
| 788 | 788 | ( | 
| 789 | - $nextSibling->tagName === 'td' | |
| 789 | + $nextSibling->tagName === 'td' | |
| 790 | 790 | || | 
| 791 | 791 | $nextSibling->tagName === 'th' | 
| 792 | - ) | |
| 793 | - ) | |
| 794 | - ) | |
| 795 | - ) | |
| 792 | + ) | |
| 793 | + ) | |
| 794 | + ) | |
| 795 | + ) | |
| 796 | 796 | || | 
| 797 | 797 | ( | 
| 798 | - ( | |
| 799 | - $tag_name === 'dd' | |
| 798 | + ( | |
| 799 | + $tag_name === 'dd' | |
| 800 | 800 | || | 
| 801 | 801 | $tag_name === 'dt' | 
| 802 | - ) | |
| 802 | + ) | |
| 803 | 803 | && | 
| 804 | 804 | ( | 
| 805 | - ( | |
| 806 | - $nextSibling === null | |
| 805 | + ( | |
| 806 | + $nextSibling === null | |
| 807 | 807 | && | 
| 808 | 808 | $tag_name === 'dd' | 
| 809 | - ) | |
| 809 | + ) | |
| 810 | 810 | || | 
| 811 | 811 | ( | 
| 812 | - $nextSibling instanceof \DOMElement | |
| 812 | + $nextSibling instanceof \DOMElement | |
| 813 | 813 | && | 
| 814 | 814 | ( | 
| 815 | - $nextSibling->tagName === 'dd' | |
| 815 | + $nextSibling->tagName === 'dd' | |
| 816 | 816 | || | 
| 817 | 817 | $nextSibling->tagName === 'dt' | 
| 818 | - ) | |
| 819 | - ) | |
| 820 | - ) | |
| 821 | - ) | |
| 818 | + ) | |
| 819 | + ) | |
| 820 | + ) | |
| 821 | + ) | |
| 822 | 822 | || | 
| 823 | 823 | ( | 
| 824 | - $tag_name === 'option' | |
| 824 | + $tag_name === 'option' | |
| 825 | 825 | && | 
| 826 | 826 | ( | 
| 827 | - $nextSibling === null | |
| 827 | + $nextSibling === null | |
| 828 | 828 | || | 
| 829 | 829 | ( | 
| 830 | - $nextSibling instanceof \DOMElement | |
| 830 | + $nextSibling instanceof \DOMElement | |
| 831 | 831 | && | 
| 832 | 832 | ( | 
| 833 | - $nextSibling->tagName === 'option' | |
| 833 | + $nextSibling->tagName === 'option' | |
| 834 | 834 | || | 
| 835 | 835 | $nextSibling->tagName === 'optgroup' | 
| 836 | - ) | |
| 837 | - ) | |
| 838 | - ) | |
| 839 | - ) | |
| 836 | + ) | |
| 837 | + ) | |
| 838 | + ) | |
| 839 | + ) | |
| 840 | 840 | || | 
| 841 | 841 | ( | 
| 842 | - $tag_name === 'p' | |
| 842 | + $tag_name === 'p' | |
| 843 | 843 | && | 
| 844 | 844 | ( | 
| 845 | - ( | |
| 846 | - $nextSibling === null | |
| 845 | + ( | |
| 846 | + $nextSibling === null | |
| 847 | 847 | && | 
| 848 | 848 | ( | 
| 849 | - $node->parentNode !== null | |
| 849 | + $node->parentNode !== null | |
| 850 | 850 | && | 
| 851 | 851 | !\in_array( | 
| 852 | - $node->parentNode->nodeName, | |
| 853 | - [ | |
| 854 | - 'a', | |
| 855 | - 'audio', | |
| 856 | - 'del', | |
| 857 | - 'ins', | |
| 858 | - 'map', | |
| 859 | - 'noscript', | |
| 860 | - 'video', | |
| 861 | - ], | |
| 862 | - true | |
| 863 | - ) | |
| 864 | - ) | |
| 865 | - ) | |
| 852 | + $node->parentNode->nodeName, | |
| 853 | + [ | |
| 854 | + 'a', | |
| 855 | + 'audio', | |
| 856 | + 'del', | |
| 857 | + 'ins', | |
| 858 | + 'map', | |
| 859 | + 'noscript', | |
| 860 | + 'video', | |
| 861 | + ], | |
| 862 | + true | |
| 863 | + ) | |
| 864 | + ) | |
| 865 | + ) | |
| 866 | 866 | || | 
| 867 | 867 | ( | 
| 868 | - $nextSibling instanceof \DOMElement | |
| 868 | + $nextSibling instanceof \DOMElement | |
| 869 | 869 | && | 
| 870 | 870 | \in_array( | 
| 871 | - $nextSibling->tagName, | |
| 872 | - [ | |
| 873 | - 'address', | |
| 874 | - 'article', | |
| 875 | - 'aside', | |
| 876 | - 'blockquote', | |
| 877 | - 'dir', | |
| 878 | - 'div', | |
| 879 | - 'dl', | |
| 880 | - 'fieldset', | |
| 881 | - 'footer', | |
| 882 | - 'form', | |
| 883 | - 'h1', | |
| 884 | - 'h2', | |
| 885 | - 'h3', | |
| 886 | - 'h4', | |
| 887 | - 'h5', | |
| 888 | - 'h6', | |
| 889 | - 'header', | |
| 890 | - 'hgroup', | |
| 891 | - 'hr', | |
| 892 | - 'menu', | |
| 893 | - 'nav', | |
| 894 | - 'ol', | |
| 895 | - 'p', | |
| 896 | - 'pre', | |
| 897 | - 'section', | |
| 898 | - 'table', | |
| 899 | - 'ul', | |
| 900 | - ], | |
| 901 | - true | |
| 902 | - ) | |
| 903 | - ) | |
| 904 | - ) | |
| 905 | - ); | |
| 871 | + $nextSibling->tagName, | |
| 872 | + [ | |
| 873 | + 'address', | |
| 874 | + 'article', | |
| 875 | + 'aside', | |
| 876 | + 'blockquote', | |
| 877 | + 'dir', | |
| 878 | + 'div', | |
| 879 | + 'dl', | |
| 880 | + 'fieldset', | |
| 881 | + 'footer', | |
| 882 | + 'form', | |
| 883 | + 'h1', | |
| 884 | + 'h2', | |
| 885 | + 'h3', | |
| 886 | + 'h4', | |
| 887 | + 'h5', | |
| 888 | + 'h6', | |
| 889 | + 'header', | |
| 890 | + 'hgroup', | |
| 891 | + 'hr', | |
| 892 | + 'menu', | |
| 893 | + 'nav', | |
| 894 | + 'ol', | |
| 895 | + 'p', | |
| 896 | + 'pre', | |
| 897 | + 'section', | |
| 898 | + 'table', | |
| 899 | + 'ul', | |
| 900 | + ], | |
| 901 | + true | |
| 902 | + ) | |
| 903 | + ) | |
| 904 | + ) | |
| 905 | + ); | |
| 906 | 906 | } | 
| 907 | 907 | |
| 908 | 908 | protected function domNodeToString(\DOMNode $node): string | 
| @@ -934,9 +934,9 @@ discard block | ||
| 934 | 934 | } | 
| 935 | 935 | |
| 936 | 936 | $html .= '<!DOCTYPE ' . $child->name . '' | 
| 937 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') | |
| 938 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') | |
| 939 | - . '>'; | |
| 937 | + . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') | |
| 938 | + . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') | |
| 939 | + . '>'; | |
| 940 | 940 | } | 
| 941 | 941 |              } elseif ($child instanceof \DOMElement) { | 
| 942 | 942 |                  $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); | 
| @@ -264,7 +264,7 @@ discard block | ||
| 264 | 264 | $attrName === 'action' | 
| 265 | 265 | ) | 
| 266 | 266 |          ) { | 
| 267 | - $attrValue = \str_replace($scheme . '://', '//', $attrValue); | |
| 267 | + $attrValue = \str_replace($scheme.'://', '//', $attrValue); | |
| 268 | 268 | } | 
| 269 | 269 | |
| 270 | 270 | return $attrValue; | 
| @@ -293,7 +293,7 @@ discard block | ||
| 293 | 293 | continue; | 
| 294 | 294 | } | 
| 295 | 295 | |
| 296 | - $attrValue .= \trim($class) . ' '; | |
| 296 | + $attrValue .= \trim($class).' '; | |
| 297 | 297 | } | 
| 298 | 298 | |
| 299 | 299 | return \trim($attrValue); |