Completed
Push — master ( 530ad1...80b635 )
by Lars
32:44 queued 17:47
created
src/voku/helper/HtmlMinDomObserverOptimizeAttributes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                 $attrName === 'action'
265 265
             )
266 266
         ) {
267
-            $attrValue = \str_replace($scheme . '://', '//', $attrValue);
267
+            $attrValue = \str_replace($scheme.'://', '//', $attrValue);
268 268
         }
269 269
 
270 270
         return $attrValue;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                 continue;
294 294
             }
295 295
 
296
-            $attrValue .= \trim($class) . ' ';
296
+            $attrValue .= \trim($class).' ';
297 297
         }
298 298
 
299 299
         return \trim($attrValue);
Please login to merge, or discard this patch.
src/voku/helper/HtmlMin.php 2 patches
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -761,214 +761,214 @@  discard block
 block discarded – undo
761 761
         return \in_array($tag_name, self::$optional_end_tags, true)
762 762
                ||
763 763
                (
764
-                   $tag_name === 'li'
764
+                    $tag_name === 'li'
765 765
                    &&
766 766
                    (
767
-                       $nextSibling === null
767
+                        $nextSibling === null
768 768
                        ||
769 769
                        (
770
-                           $nextSibling instanceof \DOMElement
770
+                            $nextSibling instanceof \DOMElement
771 771
                            &&
772 772
                            $nextSibling->tagName === 'li'
773
-                       )
774
-                   )
775
-               )
773
+                        )
774
+                    )
775
+                )
776 776
                ||
777 777
                (
778
-                   $tag_name === 'optgroup'
778
+                    $tag_name === 'optgroup'
779 779
                    &&
780 780
                    (
781
-                       $nextSibling === null
781
+                        $nextSibling === null
782 782
                        ||
783 783
                        (
784
-                           $nextSibling instanceof \DOMElement
784
+                            $nextSibling instanceof \DOMElement
785 785
                            &&
786 786
                            $nextSibling->tagName === 'optgroup'
787
-                       )
788
-                   )
789
-               )
787
+                        )
788
+                    )
789
+                )
790 790
                ||
791 791
                (
792
-                   $tag_name === 'rp'
792
+                    $tag_name === 'rp'
793 793
                    &&
794 794
                    (
795
-                       $nextSibling === null
795
+                        $nextSibling === null
796 796
                        ||
797 797
                        (
798
-                           $nextSibling instanceof \DOMElement
798
+                            $nextSibling instanceof \DOMElement
799 799
                            &&
800 800
                            (
801
-                               $nextSibling->tagName === 'rp'
801
+                                $nextSibling->tagName === 'rp'
802 802
                                ||
803 803
                                $nextSibling->tagName === 'rt'
804
-                           )
805
-                       )
806
-                   )
807
-               )
804
+                            )
805
+                        )
806
+                    )
807
+                )
808 808
                ||
809 809
                (
810
-                   $tag_name === 'tr'
810
+                    $tag_name === 'tr'
811 811
                    &&
812 812
                    (
813
-                       $nextSibling === null
813
+                        $nextSibling === null
814 814
                        ||
815 815
                        (
816
-                           $nextSibling instanceof \DOMElement
816
+                            $nextSibling instanceof \DOMElement
817 817
                            &&
818 818
                            $nextSibling->tagName === 'tr'
819
-                       )
820
-                   )
821
-               )
819
+                        )
820
+                    )
821
+                )
822 822
                ||
823 823
                (
824
-                   $tag_name === 'source'
824
+                    $tag_name === 'source'
825 825
                    &&
826 826
                    (
827
-                       $parent_tag_name === 'audio'
827
+                        $parent_tag_name === 'audio'
828 828
                        ||
829 829
                        $parent_tag_name === 'video'
830 830
                        ||
831 831
                        $parent_tag_name === 'picture'
832 832
                        ||
833 833
                        $parent_tag_name === 'source'
834
-                   )
834
+                    )
835 835
                    &&
836 836
                    (
837
-                       $nextSibling === null
837
+                        $nextSibling === null
838 838
                        ||
839 839
                        (
840
-                           $nextSibling instanceof \DOMElement
840
+                            $nextSibling instanceof \DOMElement
841 841
                            &&
842 842
                            $nextSibling->tagName === 'source'
843
-                       )
844
-                   )
845
-               )
843
+                        )
844
+                    )
845
+                )
846 846
                ||
847 847
                (
848
-                   (
849
-                       $tag_name === 'td'
848
+                    (
849
+                        $tag_name === 'td'
850 850
                        ||
851 851
                        $tag_name === 'th'
852
-                   )
852
+                    )
853 853
                    &&
854 854
                    (
855
-                       $nextSibling === null
855
+                        $nextSibling === null
856 856
                        ||
857 857
                        (
858
-                           $nextSibling instanceof \DOMElement
858
+                            $nextSibling instanceof \DOMElement
859 859
                            &&
860 860
                            (
861
-                               $nextSibling->tagName === 'td'
861
+                                $nextSibling->tagName === 'td'
862 862
                                ||
863 863
                                $nextSibling->tagName === 'th'
864
-                           )
865
-                       )
866
-                   )
867
-               )
864
+                            )
865
+                        )
866
+                    )
867
+                )
868 868
                ||
869 869
                (
870
-                   (
871
-                       $tag_name === 'dd'
870
+                    (
871
+                        $tag_name === 'dd'
872 872
                        ||
873 873
                        $tag_name === 'dt'
874
-                   )
874
+                    )
875 875
                    &&
876 876
                    (
877
-                       $nextSibling === null
877
+                        $nextSibling === null
878 878
                        ||
879 879
                        (
880
-                           $nextSibling instanceof \DOMElement
880
+                            $nextSibling instanceof \DOMElement
881 881
                            &&
882 882
                            (
883
-                               $nextSibling->tagName === 'dd'
883
+                                $nextSibling->tagName === 'dd'
884 884
                                ||
885 885
                                $nextSibling->tagName === 'dt'
886
-                           )
887
-                       )
888
-                   )
889
-               )
886
+                            )
887
+                        )
888
+                    )
889
+                )
890 890
                ||
891 891
                (
892
-                   $tag_name === 'option'
892
+                    $tag_name === 'option'
893 893
                    &&
894 894
                    (
895
-                       $nextSibling === null
895
+                        $nextSibling === null
896 896
                        ||
897 897
                        (
898
-                           $nextSibling instanceof \DOMElement
898
+                            $nextSibling instanceof \DOMElement
899 899
                            &&
900 900
                            (
901
-                               $nextSibling->tagName === 'option'
901
+                                $nextSibling->tagName === 'option'
902 902
                                ||
903 903
                                $nextSibling->tagName === 'optgroup'
904
-                           )
905
-                       )
906
-                   )
907
-               )
904
+                            )
905
+                        )
906
+                    )
907
+                )
908 908
                ||
909 909
                (
910
-                   $tag_name === 'p'
910
+                    $tag_name === 'p'
911 911
                    &&
912 912
                    (
913
-                       (
914
-                           $nextSibling === null
913
+                        (
914
+                            $nextSibling === null
915 915
                            &&
916 916
                            $node->parentNode !== null
917 917
                            &&
918 918
                            !\in_array(
919
-                               $node->parentNode->nodeName,
920
-                               [
921
-                                   'a',
922
-                                   'audio',
923
-                                   'del',
924
-                                   'ins',
925
-                                   'map',
926
-                                   'noscript',
927
-                                   'video',
928
-                               ],
929
-                               true
930
-                           )
931
-                       )
919
+                                $node->parentNode->nodeName,
920
+                                [
921
+                                    'a',
922
+                                    'audio',
923
+                                    'del',
924
+                                    'ins',
925
+                                    'map',
926
+                                    'noscript',
927
+                                    'video',
928
+                                ],
929
+                                true
930
+                            )
931
+                        )
932 932
                        ||
933 933
                        (
934
-                           $nextSibling instanceof \DOMElement
934
+                            $nextSibling instanceof \DOMElement
935 935
                            &&
936 936
                            \in_array(
937
-                               $nextSibling->tagName,
938
-                               [
939
-                                   'address',
940
-                                   'article',
941
-                                   'aside',
942
-                                   'blockquote',
943
-                                   'dir',
944
-                                   'div',
945
-                                   'dl',
946
-                                   'fieldset',
947
-                                   'footer',
948
-                                   'form',
949
-                                   'h1',
950
-                                   'h2',
951
-                                   'h3',
952
-                                   'h4',
953
-                                   'h5',
954
-                                   'h6',
955
-                                   'header',
956
-                                   'hgroup',
957
-                                   'hr',
958
-                                   'menu',
959
-                                   'nav',
960
-                                   'ol',
961
-                                   'p',
962
-                                   'pre',
963
-                                   'section',
964
-                                   'table',
965
-                                   'ul',
966
-                               ],
967
-                               true
968
-                           )
969
-                       )
970
-                   )
971
-               );
937
+                                $nextSibling->tagName,
938
+                                [
939
+                                    'address',
940
+                                    'article',
941
+                                    'aside',
942
+                                    'blockquote',
943
+                                    'dir',
944
+                                    'div',
945
+                                    'dl',
946
+                                    'fieldset',
947
+                                    'footer',
948
+                                    'form',
949
+                                    'h1',
950
+                                    'h2',
951
+                                    'h3',
952
+                                    'h4',
953
+                                    'h5',
954
+                                    'h6',
955
+                                    'header',
956
+                                    'hgroup',
957
+                                    'hr',
958
+                                    'menu',
959
+                                    'nav',
960
+                                    'ol',
961
+                                    'p',
962
+                                    'pre',
963
+                                    'section',
964
+                                    'table',
965
+                                    'ul',
966
+                                ],
967
+                                true
968
+                            )
969
+                        )
970
+                    )
971
+                );
972 972
     }
973 973
 
974 974
     protected function domNodeToString(\DOMNode $node): string
@@ -1097,9 +1097,9 @@  discard block
 block discarded – undo
1097 1097
                 }
1098 1098
 
1099 1099
                 return '<!DOCTYPE ' . $child->name . ''
1100
-                       . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
1101
-                       . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
1102
-                       . '>';
1100
+                        . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
1101
+                        . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
1102
+                        . '>';
1103 1103
             }
1104 1104
         }
1105 1105
 
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
                     $attr_val = $attribute->value;
704 704
                 }
705 705
 
706
-                $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp);
706
+                $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp);
707 707
                 $attr_str .= ' ';
708 708
             }
709 709
         }
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
             }
996 996
 
997 997
             if ($child instanceof \DOMElement) {
998
-                $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child));
999
-                $html .= '>' . $this->domNodeToString($child);
998
+                $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child));
999
+                $html .= '>'.$this->domNodeToString($child);
1000 1000
 
1001 1001
                 if (
1002 1002
                     !(
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
                         $this->domNodeClosingTagOptional($child)
1010 1010
                     )
1011 1011
                 ) {
1012
-                    $html .= '</' . $child->tagName . '>';
1012
+                    $html .= '</'.$child->tagName.'>';
1013 1013
                 }
1014 1014
 
1015 1015
                 if (!$this->doRemoveWhitespaceAroundTags) {
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
                     $html .= $child->wholeText;
1075 1075
                 }
1076 1076
             } elseif ($child instanceof \DOMComment) {
1077
-                $html .= '<!--' . $child->textContent . '-->';
1077
+                $html .= '<!--'.$child->textContent.'-->';
1078 1078
             }
1079 1079
         }
1080 1080
 
@@ -1107,9 +1107,9 @@  discard block
 block discarded – undo
1107 1107
                     $tmpTypePublic = 'PUBLIC';
1108 1108
                 }
1109 1109
 
1110
-                return '<!DOCTYPE ' . $child->name . ''
1111
-                       . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
1112
-                       . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
1110
+                return '<!DOCTYPE '.$child->name.''
1111
+                       . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '')
1112
+                       . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '')
1113 1113
                        . '>';
1114 1114
             }
1115 1115
         }
@@ -1374,18 +1374,18 @@  discard block
 block discarded – undo
1374 1374
         if (\strpos($html, ' ') !== false) {
1375 1375
             $htmlCleaned = \preg_replace_callback(
1376 1376
                 '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#',
1377
-                static function ($matches) {
1378
-                    return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>';
1377
+                static function($matches) {
1378
+                    return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>';
1379 1379
                 },
1380 1380
                 $html
1381 1381
             );
1382 1382
             if ($htmlCleaned !== null) {
1383
-                $html = (string)$htmlCleaned;
1383
+                $html = (string) $htmlCleaned;
1384 1384
             } else {
1385 1385
                 $htmlCleaned = (string) \preg_replace_callback(
1386 1386
                     '#<([^/\s<>!]+)(?:\s+([^<>]*)\s*|\s*)(/?)>#',
1387
-                    static function ($matches) {
1388
-                        return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>';
1387
+                    static function($matches) {
1388
+                        return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>';
1389 1389
                     },
1390 1390
                     $html
1391 1391
                 );
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 
1408 1408
         if (\strpos($html, $this->protectedChildNodesHelper) !== false) {
1409 1409
             $html = (string) \preg_replace_callback(
1410
-                '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/',
1410
+                '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/',
1411 1411
                 [$this, 'restoreProtectedHtml'],
1412 1412
                 $html
1413 1413
             );
@@ -1427,14 +1427,14 @@  discard block
 block discarded – undo
1427 1427
 
1428 1428
         $html = \str_replace(
1429 1429
             [
1430
-                'html>' . "\n",
1431
-                "\n" . '<html',
1432
-                'html/>' . "\n",
1433
-                "\n" . '</html',
1434
-                'head>' . "\n",
1435
-                "\n" . '<head',
1436
-                'head/>' . "\n",
1437
-                "\n" . '</head',
1430
+                'html>'."\n",
1431
+                "\n".'<html',
1432
+                'html/>'."\n",
1433
+                "\n".'</html',
1434
+                'head>'."\n",
1435
+                "\n".'<head',
1436
+                'head/>'."\n",
1437
+                "\n".'</head',
1438 1438
             ],
1439 1439
             [
1440 1440
                 'html>',
@@ -1453,11 +1453,11 @@  discard block
 block discarded – undo
1453 1453
         $replace = [];
1454 1454
         $replacement = [];
1455 1455
         foreach (self::$selfClosingTags as $selfClosingTag) {
1456
-            $replace[] = '<' . $selfClosingTag . '/>';
1457
-            $replacement[] = '<' . $selfClosingTag . '>';
1458
-            $replace[] = '<' . $selfClosingTag . ' />';
1459
-            $replacement[] = '<' . $selfClosingTag . '>';
1460
-            $replace[] = '></' . $selfClosingTag . '>';
1456
+            $replace[] = '<'.$selfClosingTag.'/>';
1457
+            $replacement[] = '<'.$selfClosingTag.'>';
1458
+            $replace[] = '<'.$selfClosingTag.' />';
1459
+            $replacement[] = '<'.$selfClosingTag.'>';
1460
+            $replace[] = '></'.$selfClosingTag.'>';
1461 1461
             $replacement[] = '>';
1462 1462
         }
1463 1463
         $html = \str_replace(
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
         // -------------------------------------------------------------------------
1666 1666
 
1667 1667
         return $dom->fixHtmlOutput(
1668
-            $doctypeStr . $this->domNodeToString($dom->getDocument()),
1668
+            $doctypeStr.$this->domNodeToString($dom->getDocument()),
1669 1669
             $multiDecodeNewHtmlEntity
1670 1670
         );
1671 1671
     }
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
             $this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml();
1711 1711
             $parentNode = $element->getNode()->parentNode;
1712 1712
             if ($parentNode !== null) {
1713
-                $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>';
1713
+                $parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>';
1714 1714
             }
1715 1715
 
1716 1716
             ++$this->protected_tags_counter;
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
             }
1745 1745
 
1746 1746
             $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml;
1747
-            $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>';
1747
+            $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>';
1748 1748
 
1749 1749
             ++$this->protected_tags_counter;
1750 1750
         }
@@ -1764,11 +1764,11 @@  discard block
 block discarded – undo
1764 1764
                 continue;
1765 1765
             }
1766 1766
 
1767
-            $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->';
1767
+            $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->';
1768 1768
 
1769 1769
             /* @var $node \DOMComment */
1770 1770
             $node = $element->getNode();
1771
-            $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>');
1771
+            $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>');
1772 1772
             $parentNode = $element->getNode()->parentNode;
1773 1773
             if ($parentNode !== null) {
1774 1774
                 $parentNode->replaceChild($child, $node);
Please login to merge, or discard this patch.