@@ -482,8 +482,8 @@ |
||
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
485 | - * @param $html |
|
486 | - * @param $decodeUtf8Specials |
|
485 | + * @param string $html |
|
486 | + * @param boolean $decodeUtf8Specials |
|
487 | 487 | * |
488 | 488 | * @return string |
489 | 489 | */ |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function minify($html, $decodeUtf8Specials = false) |
373 | 373 | { |
374 | - $html = (string)$html; |
|
374 | + $html = (string) $html; |
|
375 | 375 | if (!isset($html[0])) { |
376 | 376 | return ''; |
377 | 377 | } |
@@ -409,8 +409,8 @@ discard block |
||
409 | 409 | // Remove extra white-space(s) between HTML attribute(s) |
410 | 410 | $html = preg_replace_callback( |
411 | 411 | '#<([^\/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(\/?)>#', |
412 | - function ($matches) { |
|
413 | - return '<' . $matches[1] . preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
412 | + function($matches) { |
|
413 | + return '<'.$matches[1].preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]).$matches[3].'>'; |
|
414 | 414 | }, |
415 | 415 | $html |
416 | 416 | ); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | // ------------------------------------------------------------------------- |
424 | 424 | |
425 | 425 | $html = preg_replace_callback( |
426 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
426 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
427 | 427 | array($this, 'restoreProtectedHtml'), |
428 | 428 | $html |
429 | 429 | ); |
@@ -444,15 +444,15 @@ discard block |
||
444 | 444 | |
445 | 445 | $html = str_replace( |
446 | 446 | array( |
447 | - 'html>' . "\n", |
|
448 | - "\n" . '<html', |
|
449 | - 'html/>' . "\n", |
|
450 | - "\n" . '</html', |
|
451 | - 'head>' . "\n", |
|
452 | - "\n" . '<head', |
|
453 | - 'head/>' . "\n", |
|
454 | - "\n" . '</head', |
|
455 | - '="' . $this->booleanAttributesHelper . '"', |
|
447 | + 'html>'."\n", |
|
448 | + "\n".'<html', |
|
449 | + 'html/>'."\n", |
|
450 | + "\n".'</html', |
|
451 | + 'head>'."\n", |
|
452 | + "\n".'<head', |
|
453 | + 'head/>'."\n", |
|
454 | + "\n".'</head', |
|
455 | + '="'.$this->booleanAttributesHelper.'"', |
|
456 | 456 | ), |
457 | 457 | array( |
458 | 458 | 'html>', |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $html |
469 | 469 | ); |
470 | 470 | |
471 | - $html = preg_replace('#<\b(' . $CACHE_SELF_CLOSING_TAGS . ')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html); |
|
471 | + $html = preg_replace('#<\b('.$CACHE_SELF_CLOSING_TAGS.')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html); |
|
472 | 472 | |
473 | 473 | // ------------------------------------ |
474 | 474 | // check if compression worked |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | } |
563 | 563 | |
564 | 564 | $attrs = array(); |
565 | - foreach ((array)$attributes as $attrName => $attrValue) { |
|
565 | + foreach ((array) $attributes as $attrName => $attrValue) { |
|
566 | 566 | |
567 | 567 | if (isset(self::$booleanAttributes[$attrName])) { |
568 | 568 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | } |
648 | 648 | |
649 | 649 | $this->protectedChildNodes[$counter] = $element->text(); |
650 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
650 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
651 | 651 | |
652 | 652 | ++$counter; |
653 | 653 | } |
@@ -662,11 +662,11 @@ discard block |
||
662 | 662 | continue; |
663 | 663 | } |
664 | 664 | |
665 | - $this->protectedChildNodes[$counter] = '<!--' . $text . '-->'; |
|
665 | + $this->protectedChildNodes[$counter] = '<!--'.$text.'-->'; |
|
666 | 666 | |
667 | 667 | /* @var $node \DOMComment */ |
668 | 668 | $node = $element->getNode(); |
669 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
669 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
670 | 670 | $element->getNode()->parentNode->replaceChild($child, $node); |
671 | 671 | |
672 | 672 | ++$counter; |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | continue; |
852 | 852 | } |
853 | 853 | |
854 | - $attrValue .= trim($class) . ' '; |
|
854 | + $attrValue .= trim($class).' '; |
|
855 | 855 | } |
856 | 856 | $attrValue = trim($attrValue); |
857 | 857 |