@@ -1187,7 +1187,7 @@ |
||
1187 | 1187 | /** |
1188 | 1188 | * @param \DOMNode $node |
1189 | 1189 | * |
1190 | - * @return \DOMNode|null |
|
1190 | + * @return null|\DOMElement |
|
1191 | 1191 | */ |
1192 | 1192 | protected function getNextSiblingOfTypeDOMElement(\DOMNode $node) |
1193 | 1193 | { |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $attr_val = $attribute->value; |
544 | 544 | } |
545 | 545 | |
546 | - $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp); |
|
546 | + $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp); |
|
547 | 547 | $attr_str .= ' '; |
548 | 548 | } |
549 | 549 | } |
@@ -840,21 +840,21 @@ discard block |
||
840 | 840 | $tmpTypePublic = 'PUBLIC'; |
841 | 841 | } |
842 | 842 | |
843 | - $html .= '<!DOCTYPE ' . $child->name . '' |
|
844 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
845 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
843 | + $html .= '<!DOCTYPE '.$child->name.'' |
|
844 | + . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '') |
|
845 | + . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '') |
|
846 | 846 | . '>'; |
847 | 847 | } |
848 | 848 | } elseif ($child instanceof \DOMElement) { |
849 | - $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |
|
850 | - $html .= '>' . $this->domNodeToString($child); |
|
849 | + $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); |
|
850 | + $html .= '>'.$this->domNodeToString($child); |
|
851 | 851 | |
852 | 852 | if ( |
853 | 853 | !$this->doRemoveOmittedHtmlTags |
854 | 854 | || |
855 | 855 | !$this->domNodeClosingTagOptional($child) |
856 | 856 | ) { |
857 | - $html .= '</' . $child->tagName . '>'; |
|
857 | + $html .= '</'.$child->tagName.'>'; |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | if (!$this->doRemoveWhitespaceAroundTags) { |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | $html .= $child->wholeText; |
895 | 895 | } |
896 | 896 | } elseif ($child instanceof \DOMComment) { |
897 | - $html .= '<!--' . $child->textContent . '-->'; |
|
897 | + $html .= '<!--'.$child->textContent.'-->'; |
|
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
@@ -1099,8 +1099,8 @@ discard block |
||
1099 | 1099 | // Remove extra white-space(s) between HTML attribute(s) |
1100 | 1100 | $html = (string) \preg_replace_callback( |
1101 | 1101 | '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#u', |
1102 | - static function ($matches) { |
|
1103 | - return '<' . $matches[1] . \preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
1102 | + static function($matches) { |
|
1103 | + return '<'.$matches[1].\preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; |
|
1104 | 1104 | }, |
1105 | 1105 | $html |
1106 | 1106 | ); |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | // ------------------------------------------------------------------------- |
1116 | 1116 | |
1117 | 1117 | $html = (string) \preg_replace_callback( |
1118 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
1118 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
1119 | 1119 | [$this, 'restoreProtectedHtml'], |
1120 | 1120 | $html |
1121 | 1121 | ); |
@@ -1134,14 +1134,14 @@ discard block |
||
1134 | 1134 | |
1135 | 1135 | $html = \str_replace( |
1136 | 1136 | [ |
1137 | - 'html>' . "\n", |
|
1138 | - "\n" . '<html', |
|
1139 | - 'html/>' . "\n", |
|
1140 | - "\n" . '</html', |
|
1141 | - 'head>' . "\n", |
|
1142 | - "\n" . '<head', |
|
1143 | - 'head/>' . "\n", |
|
1144 | - "\n" . '</head', |
|
1137 | + 'html>'."\n", |
|
1138 | + "\n".'<html', |
|
1139 | + 'html/>'."\n", |
|
1140 | + "\n".'</html', |
|
1141 | + 'head>'."\n", |
|
1142 | + "\n".'<head', |
|
1143 | + 'head/>'."\n", |
|
1144 | + "\n".'</head', |
|
1145 | 1145 | ], |
1146 | 1146 | [ |
1147 | 1147 | 'html>', |
@@ -1160,10 +1160,10 @@ discard block |
||
1160 | 1160 | $replace = []; |
1161 | 1161 | $replacement = []; |
1162 | 1162 | foreach (self::$selfClosingTags as $selfClosingTag) { |
1163 | - $replace[] = '<' . $selfClosingTag . '/>'; |
|
1164 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1165 | - $replace[] = '<' . $selfClosingTag . ' />'; |
|
1166 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1163 | + $replace[] = '<'.$selfClosingTag.'/>'; |
|
1164 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1165 | + $replace[] = '<'.$selfClosingTag.' />'; |
|
1166 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1167 | 1167 | } |
1168 | 1168 | $html = \str_replace( |
1169 | 1169 | $replace, |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | $html |
1172 | 1172 | ); |
1173 | 1173 | |
1174 | - $html = (string) \preg_replace('#<\b(' . $CACHE_SELF_CLOSING_TAGS . ')([^>]*+)><\/\b\1>#', '<\\1\\2>', $html); |
|
1174 | + $html = (string) \preg_replace('#<\b('.$CACHE_SELF_CLOSING_TAGS.')([^>]*+)><\/\b\1>#', '<\\1\\2>', $html); |
|
1175 | 1175 | |
1176 | 1176 | // ------------------------------------ |
1177 | 1177 | // check if compression worked |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | } |
1348 | 1348 | |
1349 | 1349 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml(); |
1350 | - $element->getNode()->parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1350 | + $element->getNode()->parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1351 | 1351 | |
1352 | 1352 | ++$this->protected_tags_counter; |
1353 | 1353 | } |
@@ -1380,7 +1380,7 @@ discard block |
||
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml; |
1383 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1383 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1384 | 1384 | |
1385 | 1385 | ++$this->protected_tags_counter; |
1386 | 1386 | } |
@@ -1397,11 +1397,11 @@ discard block |
||
1397 | 1397 | continue; |
1398 | 1398 | } |
1399 | 1399 | |
1400 | - $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->'; |
|
1400 | + $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->'; |
|
1401 | 1401 | |
1402 | 1402 | /* @var $node \DOMComment */ |
1403 | 1403 | $node = $element->getNode(); |
1404 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
1404 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
1405 | 1405 | /** @noinspection UnusedFunctionResultInspection */ |
1406 | 1406 | $element->getNode()->parentNode->replaceChild($child, $node); |
1407 | 1407 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | \ksort($attrs); |
99 | 99 | foreach ($attrs as $attrName => $attrValue) { |
100 | 100 | $attrValue = HtmlDomParser::replaceToPreserveHtmlEntities($attrValue); |
101 | - $element->setAttribute((string)$attrName, $attrValue, true); |
|
101 | + $element->setAttribute((string) $attrName, $attrValue, true); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | continue; |
210 | 210 | } |
211 | 211 | |
212 | - $attrValue .= \trim($class) . ' '; |
|
212 | + $attrValue .= \trim($class).' '; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | return \trim($attrValue); |