@@ -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 | */ |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public function minify($html, $decodeUtf8Specials = false) |
391 | 391 | { |
392 | - $html = (string)$html; |
|
392 | + $html = (string) $html; |
|
393 | 393 | if (!isset($html[0])) { |
394 | 394 | return ''; |
395 | 395 | } |
@@ -425,25 +425,25 @@ discard block |
||
425 | 425 | // ------------------------------------------------------------------------- |
426 | 426 | |
427 | 427 | // Remove extra white-space(s) between HTML attribute(s) |
428 | - $html = (string)\preg_replace_callback( |
|
428 | + $html = (string) \preg_replace_callback( |
|
429 | 429 | '#<([^\/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(\/?)>#', |
430 | - function ($matches) { |
|
431 | - return '<' . $matches[1] . (string)\preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
430 | + function($matches) { |
|
431 | + return '<'.$matches[1].(string) \preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]).$matches[3].'>'; |
|
432 | 432 | }, |
433 | 433 | $html |
434 | 434 | ); |
435 | 435 | |
436 | 436 | |
437 | - if($this->doRemoveSpacesBetweenTags === true){ |
|
437 | + if ($this->doRemoveSpacesBetweenTags === true) { |
|
438 | 438 | // Remove spaces that are between > and < |
439 | - $html = (string)\preg_replace('/(>) (<)/', '>$2', $html); |
|
439 | + $html = (string) \preg_replace('/(>) (<)/', '>$2', $html); |
|
440 | 440 | } |
441 | 441 | // ------------------------------------------------------------------------- |
442 | 442 | // Restore protected HTML-code. |
443 | 443 | // ------------------------------------------------------------------------- |
444 | 444 | |
445 | - $html = (string)\preg_replace_callback( |
|
446 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
445 | + $html = (string) \preg_replace_callback( |
|
446 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
447 | 447 | array($this, 'restoreProtectedHtml'), |
448 | 448 | $html |
449 | 449 | ); |
@@ -464,15 +464,15 @@ discard block |
||
464 | 464 | |
465 | 465 | $html = \str_replace( |
466 | 466 | array( |
467 | - 'html>' . "\n", |
|
468 | - "\n" . '<html', |
|
469 | - 'html/>' . "\n", |
|
470 | - "\n" . '</html', |
|
471 | - 'head>' . "\n", |
|
472 | - "\n" . '<head', |
|
473 | - 'head/>' . "\n", |
|
474 | - "\n" . '</head', |
|
475 | - '="' . $this->booleanAttributesHelper . '"', |
|
467 | + 'html>'."\n", |
|
468 | + "\n".'<html', |
|
469 | + 'html/>'."\n", |
|
470 | + "\n".'</html', |
|
471 | + 'head>'."\n", |
|
472 | + "\n".'<head', |
|
473 | + 'head/>'."\n", |
|
474 | + "\n".'</head', |
|
475 | + '="'.$this->booleanAttributesHelper.'"', |
|
476 | 476 | ), |
477 | 477 | array( |
478 | 478 | 'html>', |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $html |
489 | 489 | ); |
490 | 490 | |
491 | - $html = (string)\preg_replace('#<\b(' . $CACHE_SELF_CLOSING_TAGS . ')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html); |
|
491 | + $html = (string) \preg_replace('#<\b('.$CACHE_SELF_CLOSING_TAGS.')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html); |
|
492 | 492 | |
493 | 493 | // ------------------------------------ |
494 | 494 | // check if compression worked |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | } |
583 | 583 | |
584 | 584 | $attrs = array(); |
585 | - foreach ((array)$attributes as $attrName => $attrValue) { |
|
585 | + foreach ((array) $attributes as $attrName => $attrValue) { |
|
586 | 586 | |
587 | 587 | if (isset(self::$booleanAttributes[$attrName])) { |
588 | 588 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | } |
668 | 668 | |
669 | 669 | $this->protectedChildNodes[$counter] = $element->text(); |
670 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
670 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
671 | 671 | |
672 | 672 | ++$counter; |
673 | 673 | } |
@@ -682,11 +682,11 @@ discard block |
||
682 | 682 | continue; |
683 | 683 | } |
684 | 684 | |
685 | - $this->protectedChildNodes[$counter] = '<!--' . $text . '-->'; |
|
685 | + $this->protectedChildNodes[$counter] = '<!--'.$text.'-->'; |
|
686 | 686 | |
687 | 687 | /* @var $node \DOMComment */ |
688 | 688 | $node = $element->getNode(); |
689 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
689 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
690 | 690 | $element->getNode()->parentNode->replaceChild($child, $node); |
691 | 691 | |
692 | 692 | ++$counter; |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | continue; |
872 | 872 | } |
873 | 873 | |
874 | - $attrValue .= \trim($class) . ' '; |
|
874 | + $attrValue .= \trim($class).' '; |
|
875 | 875 | } |
876 | 876 | $attrValue = \trim($attrValue); |
877 | 877 |