Completed
Pull Request — master (#100)
by
unknown
14:23
created
src/voku/helper/HtmlMin.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
                     $attr_val = $attribute->value;
709 709
                 }
710 710
 
711
-                $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp);
711
+                $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp);
712 712
                 $attr_str .= ' ';
713 713
             }
714 714
         }
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
             }
1000 1000
 
1001 1001
             if ($child instanceof \DOMElement) {
1002
-                $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child));
1003
-                $html .= '>' . $this->domNodeToString($child);
1002
+                $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child));
1003
+                $html .= '>'.$this->domNodeToString($child);
1004 1004
 
1005 1005
                 if (
1006 1006
                     !(
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
                         $this->domNodeClosingTagOptional($child)
1014 1014
                     )
1015 1015
                 ) {
1016
-                    $html .= '</' . $child->tagName . '>';
1016
+                    $html .= '</'.$child->tagName.'>';
1017 1017
                 }
1018 1018
 
1019 1019
                 if (!$this->doRemoveWhitespaceAroundTags) {
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
                     $html .= $child->wholeText;
1079 1079
                 }
1080 1080
             } elseif ($child instanceof \DOMComment) {
1081
-                $html .= '<!--' . $child->textContent . '-->';
1081
+                $html .= '<!--'.$child->textContent.'-->';
1082 1082
             }
1083 1083
         }
1084 1084
 
@@ -1111,9 +1111,9 @@  discard block
 block discarded – undo
1111 1111
                     $tmpTypePublic = 'PUBLIC';
1112 1112
                 }
1113 1113
 
1114
-                return '<!DOCTYPE ' . $child->name
1115
-                       . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
1116
-                       . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
1114
+                return '<!DOCTYPE '.$child->name
1115
+                       . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '')
1116
+                       . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '')
1117 1117
                        . '>';
1118 1118
             }
1119 1119
         }
@@ -1378,18 +1378,18 @@  discard block
 block discarded – undo
1378 1378
         if (\strpos($html, ' ') !== false) {
1379 1379
             $htmlCleaned = \preg_replace_callback(
1380 1380
                 '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#',
1381
-                static function ($matches) {
1382
-                    return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>';
1381
+                static function($matches) {
1382
+                    return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>';
1383 1383
                 },
1384 1384
                 $html
1385 1385
             );
1386 1386
             if ($htmlCleaned !== null) {
1387
-                $html = (string)$htmlCleaned;
1387
+                $html = (string) $htmlCleaned;
1388 1388
             } else {
1389 1389
                 $htmlCleaned = (string) \preg_replace_callback(
1390 1390
                     '#<([^/\s<>!]+)(?:\s+([^<>]*)\s*|\s*)(/?)>#',
1391
-                    static function ($matches) {
1392
-                        return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>';
1391
+                    static function($matches) {
1392
+                        return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>';
1393 1393
                     },
1394 1394
                     $html
1395 1395
                 );
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
 
1412 1412
         if (\strpos($html, $this->protectedChildNodesHelper) !== false) {
1413 1413
             $html = (string) \preg_replace_callback(
1414
-                '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/',
1414
+                '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/',
1415 1415
                 [$this, 'restoreProtectedHtml'],
1416 1416
                 $html
1417 1417
             );
@@ -1431,14 +1431,14 @@  discard block
 block discarded – undo
1431 1431
 
1432 1432
         $html = \str_replace(
1433 1433
             [
1434
-                'html>' . "\n",
1435
-                "\n" . '<html',
1436
-                'html/>' . "\n",
1437
-                "\n" . '</html',
1438
-                'head>' . "\n",
1439
-                "\n" . '<head',
1440
-                'head/>' . "\n",
1441
-                "\n" . '</head',
1434
+                'html>'."\n",
1435
+                "\n".'<html',
1436
+                'html/>'."\n",
1437
+                "\n".'</html',
1438
+                'head>'."\n",
1439
+                "\n".'<head',
1440
+                'head/>'."\n",
1441
+                "\n".'</head',
1442 1442
             ],
1443 1443
             [
1444 1444
                 'html>',
@@ -1457,11 +1457,11 @@  discard block
 block discarded – undo
1457 1457
         $replace = [];
1458 1458
         $replacement = [];
1459 1459
         foreach (self::$selfClosingTags as $selfClosingTag) {
1460
-            $replace[] = '<' . $selfClosingTag . '/>';
1461
-            $replacement[] = '<' . $selfClosingTag . '>';
1462
-            $replace[] = '<' . $selfClosingTag . ' />';
1463
-            $replacement[] = '<' . $selfClosingTag . '>';
1464
-            $replace[] = '></' . $selfClosingTag . '>';
1460
+            $replace[] = '<'.$selfClosingTag.'/>';
1461
+            $replacement[] = '<'.$selfClosingTag.'>';
1462
+            $replace[] = '<'.$selfClosingTag.' />';
1463
+            $replacement[] = '<'.$selfClosingTag.'>';
1464
+            $replace[] = '></'.$selfClosingTag.'>';
1465 1465
             $replacement[] = '>';
1466 1466
         }
1467 1467
         $html = \str_replace(
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
         // -------------------------------------------------------------------------
1672 1672
 
1673 1673
         return $dom->fixHtmlOutput(
1674
-            $doctypeStr . $this->domNodeToString($dom->getDocument()),
1674
+            $doctypeStr.$this->domNodeToString($dom->getDocument()),
1675 1675
             $multiDecodeNewHtmlEntity
1676 1676
         );
1677 1677
     }
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
             $parentNode = $element->parentNode();
1717 1717
             if ($parentNode->nodeValue !== null) {
1718 1718
                 $this->protectedChildNodes[$this->protected_tags_counter] = $parentNode->innerHtml();
1719
-                $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>';
1719
+                $parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>';
1720 1720
             }
1721 1721
 
1722 1722
             ++$this->protected_tags_counter;
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
             }
1751 1751
 
1752 1752
             $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml;
1753
-            $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>';
1753
+            $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>';
1754 1754
 
1755 1755
             ++$this->protected_tags_counter;
1756 1756
         }
@@ -1770,11 +1770,11 @@  discard block
 block discarded – undo
1770 1770
                 continue;
1771 1771
             }
1772 1772
 
1773
-            $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->';
1773
+            $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->';
1774 1774
 
1775 1775
             /* @var $node \DOMComment */
1776 1776
             $node = $element->getNode();
1777
-            $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>');
1777
+            $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>');
1778 1778
             $parentNode = $element->getNode()->parentNode;
1779 1779
             if ($parentNode !== null) {
1780 1780
                 $parentNode->replaceChild($child, $node);
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
 
1908 1908
             $doSkip = false;
1909 1909
             foreach (self::$skipTagsForRemoveWhitespace as $pattern) {
1910
-                if (\strpos($xp, '/' . $pattern) !== false) {
1910
+                if (\strpos($xp, '/'.$pattern) !== false) {
1911 1911
                     $doSkip = true;
1912 1912
 
1913 1913
                     break;
Please login to merge, or discard this patch.