Completed
Push — master ( 33f43e...56b778 )
by Lars
10s
created
src/voku/helper/HtmlMin.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
    */
385 385
   public function minify($html, $decodeUtf8Specials = false)
386 386
   {
387
-    $html = (string)$html;
387
+    $html = (string) $html;
388 388
     if (!isset($html[0])) {
389 389
       return '';
390 390
     }
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
     // Remove extra white-space(s) between HTML attribute(s)
423 423
     $html = preg_replace_callback(
424 424
         '#<([^\/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(\/?)>#',
425
-        function ($matches) {
426
-          return '<' . $matches[1] . preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]) . $matches[3] . '>';
425
+        function($matches) {
426
+          return '<'.$matches[1].preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]).$matches[3].'>';
427 427
         },
428 428
         $html
429 429
     );
430 430
 
431 431
 
432
-    if($this->doRemoveSpacesBetweenTags === true){
432
+    if ($this->doRemoveSpacesBetweenTags === true) {
433 433
       // Remove spaces that are between > and <
434 434
       $html = preg_replace('/(>) (<)/', '>$2', $html);
435 435
     }
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
     // -------------------------------------------------------------------------
439 439
 
440 440
     $html = preg_replace_callback(
441
-        '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/',
441
+        '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/',
442 442
         array($this, 'restoreProtectedHtml'),
443 443
         $html
444 444
     );
@@ -459,15 +459,15 @@  discard block
 block discarded – undo
459 459
 
460 460
     $html = str_replace(
461 461
         array(
462
-            'html>' . "\n",
463
-            "\n" . '<html',
464
-            'html/>' . "\n",
465
-            "\n" . '</html',
466
-            'head>' . "\n",
467
-            "\n" . '<head',
468
-            'head/>' . "\n",
469
-            "\n" . '</head',
470
-            '="' . $this->booleanAttributesHelper . '"',
462
+            'html>'."\n",
463
+            "\n".'<html',
464
+            'html/>'."\n",
465
+            "\n".'</html',
466
+            'head>'."\n",
467
+            "\n".'<head',
468
+            'head/>'."\n",
469
+            "\n".'</head',
470
+            '="'.$this->booleanAttributesHelper.'"',
471 471
         ),
472 472
         array(
473 473
             'html>',
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
         $html
484 484
     );
485 485
 
486
-    $html = preg_replace('#<\b(' . $CACHE_SELF_CLOSING_TAGS . ')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html);
486
+    $html = preg_replace('#<\b('.$CACHE_SELF_CLOSING_TAGS.')([^>]+)><\/\b\1>#', '<\\1\\2/>', $html);
487 487
 
488 488
     // ------------------------------------
489 489
     // check if compression worked
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
     }
578 578
 
579 579
     $attrs = array();
580
-    foreach ((array)$attributes as $attrName => $attrValue) {
580
+    foreach ((array) $attributes as $attrName => $attrValue) {
581 581
 
582 582
       if (isset(self::$booleanAttributes[$attrName])) {
583 583
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
       }
663 663
 
664 664
       $this->protectedChildNodes[$counter] = $element->text();
665
-      $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>';
665
+      $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>';
666 666
 
667 667
       ++$counter;
668 668
     }
@@ -677,11 +677,11 @@  discard block
 block discarded – undo
677 677
         continue;
678 678
       }
679 679
 
680
-      $this->protectedChildNodes[$counter] = '<!--' . $text . '-->';
680
+      $this->protectedChildNodes[$counter] = '<!--'.$text.'-->';
681 681
 
682 682
       /* @var $node \DOMComment */
683 683
       $node = $element->getNode();
684
-      $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>');
684
+      $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>');
685 685
       $element->getNode()->parentNode->replaceChild($child, $node);
686 686
 
687 687
       ++$counter;
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
         continue;
867 867
       }
868 868
 
869
-      $attrValue .= trim($class) . ' ';
869
+      $attrValue .= trim($class).' ';
870 870
     }
871 871
     $attrValue = trim($attrValue);
872 872
 
Please login to merge, or discard this patch.