@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function minify($html) |
| 247 | 247 | { |
| 248 | - $html = (string)$html; |
|
| 248 | + $html = (string) $html; |
|
| 249 | 249 | if (!isset($html[0])) { |
| 250 | 250 | return ''; |
| 251 | 251 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | // ------------------------------------------------------------------------- |
| 336 | 336 | |
| 337 | 337 | $html = preg_replace_callback( |
| 338 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
| 338 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
| 339 | 339 | array($this, 'restoreProtectedHtml'), |
| 340 | 340 | $html |
| 341 | 341 | ); |
@@ -349,15 +349,15 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | $html = str_replace( |
| 351 | 351 | array( |
| 352 | - 'html>' . "\n", |
|
| 353 | - "\n" . '<html', |
|
| 354 | - 'html/>' . "\n", |
|
| 355 | - "\n" . '</html', |
|
| 356 | - 'head>' . "\n", |
|
| 357 | - "\n" . '<head', |
|
| 358 | - 'head/>' . "\n", |
|
| 359 | - "\n" . '</head', |
|
| 360 | - '="' . $this->booleanAttributesHelper . '"', |
|
| 352 | + 'html>'."\n", |
|
| 353 | + "\n".'<html', |
|
| 354 | + 'html/>'."\n", |
|
| 355 | + "\n".'</html', |
|
| 356 | + 'head>'."\n", |
|
| 357 | + "\n".'<head', |
|
| 358 | + 'head/>'."\n", |
|
| 359 | + "\n".'</head', |
|
| 360 | + '="'.$this->booleanAttributesHelper.'"', |
|
| 361 | 361 | ), |
| 362 | 362 | array( |
| 363 | 363 | 'html>', |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $html |
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | - $html = preg_replace('#<\b(' . $cacheSelfClosingTags . ')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html); |
|
| 376 | + $html = preg_replace('#<\b('.$cacheSelfClosingTags.')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html); |
|
| 377 | 377 | |
| 378 | 378 | // ------------------------------------ |
| 379 | 379 | // check if compression worked |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | $attrs = array(); |
| 405 | - foreach ((array)$attributes as $attrName => $attrValue) { |
|
| 405 | + foreach ((array) $attributes as $attrName => $attrValue) { |
|
| 406 | 406 | |
| 407 | 407 | if (isset(self::$booleanAttributes[$attrName])) { |
| 408 | 408 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | $this->protectedChildNodes[$counter] = $element->text(); |
| 478 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
| 478 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
| 479 | 479 | |
| 480 | 480 | ++$counter; |
| 481 | 481 | } |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | continue; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - $this->protectedChildNodes[$counter] = '<!--' . $text . '-->'; |
|
| 493 | + $this->protectedChildNodes[$counter] = '<!--'.$text.'-->'; |
|
| 494 | 494 | |
| 495 | 495 | /* @var $node \DOMComment */ |
| 496 | 496 | $node = $element->getNode(); |
| 497 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
| 497 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
| 498 | 498 | $element->getNode()->parentNode->replaceChild($child, $node); |
| 499 | 499 | |
| 500 | 500 | ++$counter; |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | if (!$class) { |
| 792 | 792 | continue; |
| 793 | 793 | } |
| 794 | - $attrValue .= trim($class) . ' '; |
|
| 794 | + $attrValue .= trim($class).' '; |
|
| 795 | 795 | } |
| 796 | 796 | $attrValue = trim($attrValue); |
| 797 | 797 | |