Completed
Push — master ( 9bf2bb...33f43e )
by Lars
04:27
created
src/voku/helper/HtmlMin.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
851 851
         continue;
852 852
       }
853 853
 
854
-      $attrValue .= trim($class) . ' ';
854
+      $attrValue .= trim($class).' ';
855 855
     }
856 856
     $attrValue = trim($attrValue);
857 857
 
Please login to merge, or discard this patch.