| @@ -202,7 +202,7 @@ | ||
| 202 | 202 | continue; | 
| 203 | 203 | } | 
| 204 | 204 | |
| 205 | - $attrValue .= \trim($class) . ' '; | |
| 205 | + $attrValue .= \trim($class).' '; | |
| 206 | 206 | } | 
| 207 | 207 | |
| 208 | 208 | return \trim($attrValue); | 
| @@ -778,206 +778,206 @@ discard block | ||
| 778 | 778 | return \in_array($tag_name, self::$optional_end_tags, true) | 
| 779 | 779 | || | 
| 780 | 780 | ( | 
| 781 | - $tag_name === 'li' | |
| 781 | + $tag_name === 'li' | |
| 782 | 782 | && | 
| 783 | 783 | ( | 
| 784 | - $nextSibling === null | |
| 784 | + $nextSibling === null | |
| 785 | 785 | || | 
| 786 | 786 | ( | 
| 787 | - $nextSibling instanceof \DOMElement | |
| 787 | + $nextSibling instanceof \DOMElement | |
| 788 | 788 | && | 
| 789 | 789 | $nextSibling->tagName === 'li' | 
| 790 | - ) | |
| 791 | - ) | |
| 792 | - ) | |
| 790 | + ) | |
| 791 | + ) | |
| 792 | + ) | |
| 793 | 793 | || | 
| 794 | 794 | ( | 
| 795 | - $tag_name === 'rp' | |
| 795 | + $tag_name === 'rp' | |
| 796 | 796 | && | 
| 797 | 797 | ( | 
| 798 | - $nextSibling === null | |
| 798 | + $nextSibling === null | |
| 799 | 799 | || | 
| 800 | 800 | ( | 
| 801 | - $nextSibling instanceof \DOMElement | |
| 801 | + $nextSibling instanceof \DOMElement | |
| 802 | 802 | && | 
| 803 | 803 | ( | 
| 804 | - $nextSibling->tagName === 'rp' | |
| 804 | + $nextSibling->tagName === 'rp' | |
| 805 | 805 | || | 
| 806 | 806 | $nextSibling->tagName === 'rt' | 
| 807 | - ) | |
| 808 | - ) | |
| 809 | - ) | |
| 810 | - ) | |
| 807 | + ) | |
| 808 | + ) | |
| 809 | + ) | |
| 810 | + ) | |
| 811 | 811 | || | 
| 812 | 812 | ( | 
| 813 | - $tag_name === 'tr' | |
| 813 | + $tag_name === 'tr' | |
| 814 | 814 | && | 
| 815 | 815 | ( | 
| 816 | - $nextSibling === null | |
| 816 | + $nextSibling === null | |
| 817 | 817 | || | 
| 818 | 818 | ( | 
| 819 | - $nextSibling instanceof \DOMElement | |
| 819 | + $nextSibling instanceof \DOMElement | |
| 820 | 820 | && | 
| 821 | 821 | $nextSibling->tagName === 'tr' | 
| 822 | - ) | |
| 823 | - ) | |
| 824 | - ) | |
| 822 | + ) | |
| 823 | + ) | |
| 824 | + ) | |
| 825 | 825 | || | 
| 826 | 826 | ( | 
| 827 | - $tag_name === 'source' | |
| 827 | + $tag_name === 'source' | |
| 828 | 828 | && | 
| 829 | 829 | ( | 
| 830 | - $parent_tag_name === 'audio' | |
| 830 | + $parent_tag_name === 'audio' | |
| 831 | 831 | || | 
| 832 | 832 | $parent_tag_name === 'video' | 
| 833 | 833 | || | 
| 834 | 834 | $parent_tag_name === 'picture' | 
| 835 | 835 | || | 
| 836 | 836 | $parent_tag_name === 'source' | 
| 837 | - ) | |
| 837 | + ) | |
| 838 | 838 | && | 
| 839 | 839 | ( | 
| 840 | - $nextSibling === null | |
| 840 | + $nextSibling === null | |
| 841 | 841 | || | 
| 842 | 842 | ( | 
| 843 | - $nextSibling instanceof \DOMElement | |
| 843 | + $nextSibling instanceof \DOMElement | |
| 844 | 844 | && | 
| 845 | 845 | $nextSibling->tagName === 'source' | 
| 846 | - ) | |
| 847 | - ) | |
| 848 | - ) | |
| 846 | + ) | |
| 847 | + ) | |
| 848 | + ) | |
| 849 | 849 | || | 
| 850 | 850 | ( | 
| 851 | - ( | |
| 852 | - $tag_name === 'td' | |
| 851 | + ( | |
| 852 | + $tag_name === 'td' | |
| 853 | 853 | || | 
| 854 | 854 | $tag_name === 'th' | 
| 855 | - ) | |
| 855 | + ) | |
| 856 | 856 | && | 
| 857 | 857 | ( | 
| 858 | - $nextSibling === null | |
| 858 | + $nextSibling === null | |
| 859 | 859 | || | 
| 860 | 860 | ( | 
| 861 | - $nextSibling instanceof \DOMElement | |
| 861 | + $nextSibling instanceof \DOMElement | |
| 862 | 862 | && | 
| 863 | 863 | ( | 
| 864 | - $nextSibling->tagName === 'td' | |
| 864 | + $nextSibling->tagName === 'td' | |
| 865 | 865 | || | 
| 866 | 866 | $nextSibling->tagName === 'th' | 
| 867 | - ) | |
| 868 | - ) | |
| 869 | - ) | |
| 870 | - ) | |
| 867 | + ) | |
| 868 | + ) | |
| 869 | + ) | |
| 870 | + ) | |
| 871 | 871 | || | 
| 872 | 872 | ( | 
| 873 | - ( | |
| 874 | - $tag_name === 'dd' | |
| 873 | + ( | |
| 874 | + $tag_name === 'dd' | |
| 875 | 875 | || | 
| 876 | 876 | $tag_name === 'dt' | 
| 877 | - ) | |
| 877 | + ) | |
| 878 | 878 | && | 
| 879 | 879 | ( | 
| 880 | - ( | |
| 881 | - $nextSibling === null | |
| 880 | + ( | |
| 881 | + $nextSibling === null | |
| 882 | 882 | && | 
| 883 | 883 | $tag_name === 'dd' | 
| 884 | - ) | |
| 884 | + ) | |
| 885 | 885 | || | 
| 886 | 886 | ( | 
| 887 | - $nextSibling instanceof \DOMElement | |
| 887 | + $nextSibling instanceof \DOMElement | |
| 888 | 888 | && | 
| 889 | 889 | ( | 
| 890 | - $nextSibling->tagName === 'dd' | |
| 890 | + $nextSibling->tagName === 'dd' | |
| 891 | 891 | || | 
| 892 | 892 | $nextSibling->tagName === 'dt' | 
| 893 | - ) | |
| 894 | - ) | |
| 895 | - ) | |
| 896 | - ) | |
| 893 | + ) | |
| 894 | + ) | |
| 895 | + ) | |
| 896 | + ) | |
| 897 | 897 | || | 
| 898 | 898 | ( | 
| 899 | - $tag_name === 'option' | |
| 899 | + $tag_name === 'option' | |
| 900 | 900 | && | 
| 901 | 901 | ( | 
| 902 | - $nextSibling === null | |
| 902 | + $nextSibling === null | |
| 903 | 903 | || | 
| 904 | 904 | ( | 
| 905 | - $nextSibling instanceof \DOMElement | |
| 905 | + $nextSibling instanceof \DOMElement | |
| 906 | 906 | && | 
| 907 | 907 | ( | 
| 908 | - $nextSibling->tagName === 'option' | |
| 908 | + $nextSibling->tagName === 'option' | |
| 909 | 909 | || | 
| 910 | 910 | $nextSibling->tagName === 'optgroup' | 
| 911 | - ) | |
| 912 | - ) | |
| 913 | - ) | |
| 914 | - ) | |
| 911 | + ) | |
| 912 | + ) | |
| 913 | + ) | |
| 914 | + ) | |
| 915 | 915 | || | 
| 916 | 916 | ( | 
| 917 | - $tag_name === 'p' | |
| 917 | + $tag_name === 'p' | |
| 918 | 918 | && | 
| 919 | 919 | ( | 
| 920 | - ( | |
| 921 | - $nextSibling === null | |
| 920 | + ( | |
| 921 | + $nextSibling === null | |
| 922 | 922 | && | 
| 923 | 923 | ( | 
| 924 | - $node->parentNode !== null | |
| 924 | + $node->parentNode !== null | |
| 925 | 925 | && | 
| 926 | 926 | !\in_array( | 
| 927 | - $node->parentNode->nodeName, | |
| 928 | - [ | |
| 929 | - 'a', | |
| 930 | - 'audio', | |
| 931 | - 'del', | |
| 932 | - 'ins', | |
| 933 | - 'map', | |
| 934 | - 'noscript', | |
| 935 | - 'video', | |
| 936 | - ], | |
| 937 | - true | |
| 938 | - ) | |
| 939 | - ) | |
| 940 | - ) | |
| 927 | + $node->parentNode->nodeName, | |
| 928 | + [ | |
| 929 | + 'a', | |
| 930 | + 'audio', | |
| 931 | + 'del', | |
| 932 | + 'ins', | |
| 933 | + 'map', | |
| 934 | + 'noscript', | |
| 935 | + 'video', | |
| 936 | + ], | |
| 937 | + true | |
| 938 | + ) | |
| 939 | + ) | |
| 940 | + ) | |
| 941 | 941 | || | 
| 942 | 942 | ( | 
| 943 | - $nextSibling instanceof \DOMElement | |
| 943 | + $nextSibling instanceof \DOMElement | |
| 944 | 944 | && | 
| 945 | 945 | \in_array( | 
| 946 | - $nextSibling->tagName, | |
| 947 | - [ | |
| 948 | - 'address', | |
| 949 | - 'article', | |
| 950 | - 'aside', | |
| 951 | - 'blockquote', | |
| 952 | - 'dir', | |
| 953 | - 'div', | |
| 954 | - 'dl', | |
| 955 | - 'fieldset', | |
| 956 | - 'footer', | |
| 957 | - 'form', | |
| 958 | - 'h1', | |
| 959 | - 'h2', | |
| 960 | - 'h3', | |
| 961 | - 'h4', | |
| 962 | - 'h5', | |
| 963 | - 'h6', | |
| 964 | - 'header', | |
| 965 | - 'hgroup', | |
| 966 | - 'hr', | |
| 967 | - 'menu', | |
| 968 | - 'nav', | |
| 969 | - 'ol', | |
| 970 | - 'p', | |
| 971 | - 'pre', | |
| 972 | - 'section', | |
| 973 | - 'table', | |
| 974 | - 'ul', | |
| 975 | - ], | |
| 976 | - true | |
| 977 | - ) | |
| 978 | - ) | |
| 979 | - ) | |
| 980 | - ); | |
| 946 | + $nextSibling->tagName, | |
| 947 | + [ | |
| 948 | + 'address', | |
| 949 | + 'article', | |
| 950 | + 'aside', | |
| 951 | + 'blockquote', | |
| 952 | + 'dir', | |
| 953 | + 'div', | |
| 954 | + 'dl', | |
| 955 | + 'fieldset', | |
| 956 | + 'footer', | |
| 957 | + 'form', | |
| 958 | + 'h1', | |
| 959 | + 'h2', | |
| 960 | + 'h3', | |
| 961 | + 'h4', | |
| 962 | + 'h5', | |
| 963 | + 'h6', | |
| 964 | + 'header', | |
| 965 | + 'hgroup', | |
| 966 | + 'hr', | |
| 967 | + 'menu', | |
| 968 | + 'nav', | |
| 969 | + 'ol', | |
| 970 | + 'p', | |
| 971 | + 'pre', | |
| 972 | + 'section', | |
| 973 | + 'table', | |
| 974 | + 'ul', | |
| 975 | + ], | |
| 976 | + true | |
| 977 | + ) | |
| 978 | + ) | |
| 979 | + ) | |
| 980 | + ); | |
| 981 | 981 | } | 
| 982 | 982 | |
| 983 | 983 | protected function domNodeToString(\DOMNode $node): string | 
| @@ -1009,9 +1009,9 @@ discard block | ||
| 1009 | 1009 | } | 
| 1010 | 1010 | |
| 1011 | 1011 | $html .= '<!DOCTYPE ' . $child->name . '' | 
| 1012 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') | |
| 1013 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') | |
| 1014 | - . '>'; | |
| 1012 | + . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') | |
| 1013 | + . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') | |
| 1014 | + . '>'; | |
| 1015 | 1015 | } | 
| 1016 | 1016 |              } elseif ($child instanceof \DOMElement) { | 
| 1017 | 1017 |                  $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); | 
| @@ -714,7 +714,7 @@ discard block | ||
| 714 | 714 | $attr_val = $attribute->value; | 
| 715 | 715 | } | 
| 716 | 716 | |
| 717 | - $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp); | |
| 717 | + $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp); | |
| 718 | 718 | $attr_str .= ' '; | 
| 719 | 719 | } | 
| 720 | 720 | } | 
| @@ -1008,21 +1008,21 @@ discard block | ||
| 1008 | 1008 | $tmpTypePublic = 'PUBLIC'; | 
| 1009 | 1009 | } | 
| 1010 | 1010 | |
| 1011 | - $html .= '<!DOCTYPE ' . $child->name . '' | |
| 1012 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') | |
| 1013 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') | |
| 1011 | + $html .= '<!DOCTYPE '.$child->name.'' | |
| 1012 | + . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '') | |
| 1013 | + . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '') | |
| 1014 | 1014 | . '>'; | 
| 1015 | 1015 | } | 
| 1016 | 1016 |              } elseif ($child instanceof \DOMElement) { | 
| 1017 | -                $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); | |
| 1018 | - $html .= '>' . $this->domNodeToString($child); | |
| 1017 | +                $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); | |
| 1018 | + $html .= '>'.$this->domNodeToString($child); | |
| 1019 | 1019 | |
| 1020 | 1020 | if ( | 
| 1021 | 1021 | !$this->doRemoveOmittedHtmlTags | 
| 1022 | 1022 | || | 
| 1023 | 1023 | !$this->domNodeClosingTagOptional($child) | 
| 1024 | 1024 |                  ) { | 
| 1025 | - $html .= '</' . $child->tagName . '>'; | |
| 1025 | + $html .= '</'.$child->tagName.'>'; | |
| 1026 | 1026 | } | 
| 1027 | 1027 | |
| 1028 | 1028 |                  if (!$this->doRemoveWhitespaceAroundTags) { | 
| @@ -1062,7 +1062,7 @@ discard block | ||
| 1062 | 1062 | $html .= $child->wholeText; | 
| 1063 | 1063 | } | 
| 1064 | 1064 |              } elseif ($child instanceof \DOMComment) { | 
| 1065 | - $html .= '<!--' . $child->textContent . '-->'; | |
| 1065 | + $html .= '<!--'.$child->textContent.'-->'; | |
| 1066 | 1066 | } | 
| 1067 | 1067 | } | 
| 1068 | 1068 | |
| @@ -1154,8 +1154,8 @@ discard block | ||
| 1154 | 1154 | // Remove extra white-space(s) between HTML attribute(s) | 
| 1155 | 1155 | $html = (string) \preg_replace_callback( | 
| 1156 | 1156 | '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#u', | 
| 1157 | -            static function ($matches) { | |
| 1158 | -                return '<' . $matches[1] . \preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; | |
| 1157 | +            static function($matches) { | |
| 1158 | +                return '<'.$matches[1].\preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; | |
| 1159 | 1159 | }, | 
| 1160 | 1160 | $html | 
| 1161 | 1161 | ); | 
| @@ -1170,7 +1170,7 @@ discard block | ||
| 1170 | 1170 | // ------------------------------------------------------------------------- | 
| 1171 | 1171 | |
| 1172 | 1172 | $html = (string) \preg_replace_callback( | 
| 1173 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', | |
| 1173 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', | |
| 1174 | 1174 | [$this, 'restoreProtectedHtml'], | 
| 1175 | 1175 | $html | 
| 1176 | 1176 | ); | 
| @@ -1189,14 +1189,14 @@ discard block | ||
| 1189 | 1189 | |
| 1190 | 1190 | $html = \str_replace( | 
| 1191 | 1191 | [ | 
| 1192 | - 'html>' . "\n", | |
| 1193 | - "\n" . '<html', | |
| 1194 | - 'html/>' . "\n", | |
| 1195 | - "\n" . '</html', | |
| 1196 | - 'head>' . "\n", | |
| 1197 | - "\n" . '<head', | |
| 1198 | - 'head/>' . "\n", | |
| 1199 | - "\n" . '</head', | |
| 1192 | + 'html>'."\n", | |
| 1193 | + "\n".'<html', | |
| 1194 | + 'html/>'."\n", | |
| 1195 | + "\n".'</html', | |
| 1196 | + 'head>'."\n", | |
| 1197 | + "\n".'<head', | |
| 1198 | + 'head/>'."\n", | |
| 1199 | + "\n".'</head', | |
| 1200 | 1200 | ], | 
| 1201 | 1201 | [ | 
| 1202 | 1202 | 'html>', | 
| @@ -1215,10 +1215,10 @@ discard block | ||
| 1215 | 1215 | $replace = []; | 
| 1216 | 1216 | $replacement = []; | 
| 1217 | 1217 |          foreach (self::$selfClosingTags as $selfClosingTag) { | 
| 1218 | - $replace[] = '<' . $selfClosingTag . '/>'; | |
| 1219 | - $replacement[] = '<' . $selfClosingTag . '>'; | |
| 1220 | - $replace[] = '<' . $selfClosingTag . ' />'; | |
| 1221 | - $replacement[] = '<' . $selfClosingTag . '>'; | |
| 1218 | + $replace[] = '<'.$selfClosingTag.'/>'; | |
| 1219 | + $replacement[] = '<'.$selfClosingTag.'>'; | |
| 1220 | + $replace[] = '<'.$selfClosingTag.' />'; | |
| 1221 | + $replacement[] = '<'.$selfClosingTag.'>'; | |
| 1222 | 1222 | } | 
| 1223 | 1223 | $html = \str_replace( | 
| 1224 | 1224 | $replace, | 
| @@ -1226,7 +1226,7 @@ discard block | ||
| 1226 | 1226 | $html | 
| 1227 | 1227 | ); | 
| 1228 | 1228 | |
| 1229 | -        $html = (string) \preg_replace('#<\b(' . $CACHE_SELF_CLOSING_TAGS . ')([^>]*+)><\/\b\1>#', '<\\1\\2>', $html); | |
| 1229 | +        $html = (string) \preg_replace('#<\b('.$CACHE_SELF_CLOSING_TAGS.')([^>]*+)><\/\b\1>#', '<\\1\\2>', $html); | |
| 1230 | 1230 | |
| 1231 | 1231 | // ------------------------------------ | 
| 1232 | 1232 | // check if compression worked | 
| @@ -1333,7 +1333,7 @@ discard block | ||
| 1333 | 1333 | } | 
| 1334 | 1334 | |
| 1335 | 1335 | $this->protectedChildNodes[$counter] = $element->innerhtml; | 
| 1336 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'; | |
| 1336 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'; | |
| 1337 | 1337 | |
| 1338 | 1338 | ++$counter; | 
| 1339 | 1339 | } | 
| @@ -1344,7 +1344,7 @@ discard block | ||
| 1344 | 1344 | } | 
| 1345 | 1345 | |
| 1346 | 1346 | $this->protectedChildNodes[$counter] = $element->parentNode()->innerHtml(); | 
| 1347 | - $element->getNode()->parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'; | |
| 1347 | + $element->getNode()->parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'; | |
| 1348 | 1348 | |
| 1349 | 1349 | ++$counter; | 
| 1350 | 1350 | } | 
| @@ -1357,11 +1357,11 @@ discard block | ||
| 1357 | 1357 | continue; | 
| 1358 | 1358 | } | 
| 1359 | 1359 | |
| 1360 | - $this->protectedChildNodes[$counter] = '<!--' . $text . '-->'; | |
| 1360 | + $this->protectedChildNodes[$counter] = '<!--'.$text.'-->'; | |
| 1361 | 1361 | |
| 1362 | 1362 | /* @var $node \DOMComment */ | 
| 1363 | 1363 | $node = $element->getNode(); | 
| 1364 | -            $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'); | |
| 1364 | +            $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'); | |
| 1365 | 1365 | /** @noinspection UnusedFunctionResultInspection */ | 
| 1366 | 1366 | $element->getNode()->parentNode->replaceChild($child, $node); | 
| 1367 | 1367 | |