Completed
Push — master ( 24ed29...12288c )
by Lars
06:22
created
src/voku/helper/HtmlMinDomObserverOptimizeAttributes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
                 continue;
203 203
             }
204 204
 
205
-            $attrValue .= \trim($class) . ' ';
205
+            $attrValue .= \trim($class).' ';
206 206
         }
207 207
 
208 208
         return \trim($attrValue);
Please login to merge, or discard this patch.
src/voku/helper/HtmlMin.php 3 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -778,206 +778,206 @@  discard block
 block discarded – undo
778 778
         return \in_array($tag_name, self::$optional_end_tags, true)
779 779
                ||
780 780
                (
781
-                   $tag_name === 'li'
781
+                    $tag_name === 'li'
782 782
                    &&
783 783
                    (
784
-                       $nextSibling === null
784
+                        $nextSibling === null
785 785
                        ||
786 786
                        (
787
-                           $nextSibling instanceof \DOMElement
787
+                            $nextSibling instanceof \DOMElement
788 788
                            &&
789 789
                            $nextSibling->tagName === 'li'
790
-                       )
791
-                   )
792
-               )
790
+                        )
791
+                    )
792
+                )
793 793
                ||
794 794
                (
795
-                   $tag_name === 'rp'
795
+                    $tag_name === 'rp'
796 796
                    &&
797 797
                    (
798
-                       $nextSibling === null
798
+                        $nextSibling === null
799 799
                        ||
800 800
                        (
801
-                           $nextSibling instanceof \DOMElement
801
+                            $nextSibling instanceof \DOMElement
802 802
                            &&
803 803
                            (
804
-                               $nextSibling->tagName === 'rp'
804
+                                $nextSibling->tagName === 'rp'
805 805
                                ||
806 806
                                $nextSibling->tagName === 'rt'
807
-                           )
808
-                       )
809
-                   )
810
-               )
807
+                            )
808
+                        )
809
+                    )
810
+                )
811 811
                ||
812 812
                (
813
-                   $tag_name === 'tr'
813
+                    $tag_name === 'tr'
814 814
                    &&
815 815
                    (
816
-                       $nextSibling === null
816
+                        $nextSibling === null
817 817
                        ||
818 818
                        (
819
-                           $nextSibling instanceof \DOMElement
819
+                            $nextSibling instanceof \DOMElement
820 820
                            &&
821 821
                            $nextSibling->tagName === 'tr'
822
-                       )
823
-                   )
824
-               )
822
+                        )
823
+                    )
824
+                )
825 825
                ||
826 826
                (
827
-                   $tag_name === 'source'
827
+                    $tag_name === 'source'
828 828
                    &&
829 829
                    (
830
-                       $parent_tag_name === 'audio'
830
+                        $parent_tag_name === 'audio'
831 831
                        ||
832 832
                        $parent_tag_name === 'video'
833 833
                        ||
834 834
                        $parent_tag_name === 'picture'
835 835
                        ||
836 836
                        $parent_tag_name === 'source'
837
-                   )
837
+                    )
838 838
                    &&
839 839
                    (
840
-                       $nextSibling === null
840
+                        $nextSibling === null
841 841
                        ||
842 842
                        (
843
-                           $nextSibling instanceof \DOMElement
843
+                            $nextSibling instanceof \DOMElement
844 844
                            &&
845 845
                            $nextSibling->tagName === 'source'
846
-                       )
847
-                   )
848
-               )
846
+                        )
847
+                    )
848
+                )
849 849
                ||
850 850
                (
851
-                   (
852
-                       $tag_name === 'td'
851
+                    (
852
+                        $tag_name === 'td'
853 853
                        ||
854 854
                        $tag_name === 'th'
855
-                   )
855
+                    )
856 856
                    &&
857 857
                    (
858
-                       $nextSibling === null
858
+                        $nextSibling === null
859 859
                        ||
860 860
                        (
861
-                           $nextSibling instanceof \DOMElement
861
+                            $nextSibling instanceof \DOMElement
862 862
                            &&
863 863
                            (
864
-                               $nextSibling->tagName === 'td'
864
+                                $nextSibling->tagName === 'td'
865 865
                                ||
866 866
                                $nextSibling->tagName === 'th'
867
-                           )
868
-                       )
869
-                   )
870
-               )
867
+                            )
868
+                        )
869
+                    )
870
+                )
871 871
                ||
872 872
                (
873
-                   (
874
-                       $tag_name === 'dd'
873
+                    (
874
+                        $tag_name === 'dd'
875 875
                        ||
876 876
                        $tag_name === 'dt'
877
-                   )
877
+                    )
878 878
                    &&
879 879
                    (
880
-                       (
881
-                           $nextSibling === null
880
+                        (
881
+                            $nextSibling === null
882 882
                            &&
883 883
                            $tag_name === 'dd'
884
-                       )
884
+                        )
885 885
                        ||
886 886
                        (
887
-                           $nextSibling instanceof \DOMElement
887
+                            $nextSibling instanceof \DOMElement
888 888
                            &&
889 889
                            (
890
-                               $nextSibling->tagName === 'dd'
890
+                                $nextSibling->tagName === 'dd'
891 891
                                ||
892 892
                                $nextSibling->tagName === 'dt'
893
-                           )
894
-                       )
895
-                   )
896
-               )
893
+                            )
894
+                        )
895
+                    )
896
+                )
897 897
                ||
898 898
                (
899
-                   $tag_name === 'option'
899
+                    $tag_name === 'option'
900 900
                    &&
901 901
                    (
902
-                       $nextSibling === null
902
+                        $nextSibling === null
903 903
                        ||
904 904
                        (
905
-                           $nextSibling instanceof \DOMElement
905
+                            $nextSibling instanceof \DOMElement
906 906
                            &&
907 907
                            (
908
-                               $nextSibling->tagName === 'option'
908
+                                $nextSibling->tagName === 'option'
909 909
                                ||
910 910
                                $nextSibling->tagName === 'optgroup'
911
-                           )
912
-                       )
913
-                   )
914
-               )
911
+                            )
912
+                        )
913
+                    )
914
+                )
915 915
                ||
916 916
                (
917
-                   $tag_name === 'p'
917
+                    $tag_name === 'p'
918 918
                    &&
919 919
                    (
920
-                       (
921
-                           $nextSibling === null
920
+                        (
921
+                            $nextSibling === null
922 922
                            &&
923 923
                            (
924
-                               $node->parentNode !== null
924
+                                $node->parentNode !== null
925 925
                                &&
926 926
                                !\in_array(
927
-                                   $node->parentNode->nodeName,
928
-                                   [
929
-                                       'a',
930
-                                       'audio',
931
-                                       'del',
932
-                                       'ins',
933
-                                       'map',
934
-                                       'noscript',
935
-                                       'video',
936
-                                   ],
937
-                                   true
938
-                               )
939
-                           )
940
-                       )
927
+                                    $node->parentNode->nodeName,
928
+                                    [
929
+                                        'a',
930
+                                        'audio',
931
+                                        'del',
932
+                                        'ins',
933
+                                        'map',
934
+                                        'noscript',
935
+                                        'video',
936
+                                    ],
937
+                                    true
938
+                                )
939
+                            )
940
+                        )
941 941
                        ||
942 942
                        (
943
-                           $nextSibling instanceof \DOMElement
943
+                            $nextSibling instanceof \DOMElement
944 944
                            &&
945 945
                            \in_array(
946
-                               $nextSibling->tagName,
947
-                               [
948
-                                   'address',
949
-                                   'article',
950
-                                   'aside',
951
-                                   'blockquote',
952
-                                   'dir',
953
-                                   'div',
954
-                                   'dl',
955
-                                   'fieldset',
956
-                                   'footer',
957
-                                   'form',
958
-                                   'h1',
959
-                                   'h2',
960
-                                   'h3',
961
-                                   'h4',
962
-                                   'h5',
963
-                                   'h6',
964
-                                   'header',
965
-                                   'hgroup',
966
-                                   'hr',
967
-                                   'menu',
968
-                                   'nav',
969
-                                   'ol',
970
-                                   'p',
971
-                                   'pre',
972
-                                   'section',
973
-                                   'table',
974
-                                   'ul',
975
-                               ],
976
-                               true
977
-                           )
978
-                       )
979
-                   )
980
-               );
946
+                                $nextSibling->tagName,
947
+                                [
948
+                                    'address',
949
+                                    'article',
950
+                                    'aside',
951
+                                    'blockquote',
952
+                                    'dir',
953
+                                    'div',
954
+                                    'dl',
955
+                                    'fieldset',
956
+                                    'footer',
957
+                                    'form',
958
+                                    'h1',
959
+                                    'h2',
960
+                                    'h3',
961
+                                    'h4',
962
+                                    'h5',
963
+                                    'h6',
964
+                                    'header',
965
+                                    'hgroup',
966
+                                    'hr',
967
+                                    'menu',
968
+                                    'nav',
969
+                                    'ol',
970
+                                    'p',
971
+                                    'pre',
972
+                                    'section',
973
+                                    'table',
974
+                                    'ul',
975
+                                ],
976
+                                true
977
+                            )
978
+                        )
979
+                    )
980
+                );
981 981
     }
982 982
 
983 983
     protected function domNodeToString(\DOMNode $node): string
@@ -1009,9 +1009,9 @@  discard block
 block discarded – undo
1009 1009
                     }
1010 1010
 
1011 1011
                     $html .= '<!DOCTYPE ' . $child->name . ''
1012
-                             . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
1013
-                             . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
1014
-                             . '>';
1012
+                              . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
1013
+                              . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
1014
+                              . '>';
1015 1015
                 }
1016 1016
             } elseif ($child instanceof \DOMElement) {
1017 1017
                 $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child));
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1187,7 +1187,7 @@
 block discarded – undo
1187 1187
     /**
1188 1188
      * @param \DOMNode $node
1189 1189
      *
1190
-     * @return \DOMNode|null
1190
+     * @return null|\DOMElement
1191 1191
      */
1192 1192
     protected function getNextSiblingOfTypeDOMElement(\DOMNode $node)
1193 1193
     {
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                     $attr_val = $attribute->value;
544 544
                 }
545 545
 
546
-                $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp);
546
+                $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp);
547 547
                 $attr_str .= ' ';
548 548
             }
549 549
         }
@@ -840,21 +840,21 @@  discard block
 block discarded – undo
840 840
                         $tmpTypePublic = 'PUBLIC';
841 841
                     }
842 842
 
843
-                    $html .= '<!DOCTYPE ' . $child->name . ''
844
-                             . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
845
-                             . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
843
+                    $html .= '<!DOCTYPE '.$child->name.''
844
+                             . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '')
845
+                             . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '')
846 846
                              . '>';
847 847
                 }
848 848
             } elseif ($child instanceof \DOMElement) {
849
-                $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child));
850
-                $html .= '>' . $this->domNodeToString($child);
849
+                $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child));
850
+                $html .= '>'.$this->domNodeToString($child);
851 851
 
852 852
                 if (
853 853
                     !$this->doRemoveOmittedHtmlTags
854 854
                     ||
855 855
                     !$this->domNodeClosingTagOptional($child)
856 856
                 ) {
857
-                    $html .= '</' . $child->tagName . '>';
857
+                    $html .= '</'.$child->tagName.'>';
858 858
                 }
859 859
 
860 860
                 if (!$this->doRemoveWhitespaceAroundTags) {
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
                     $html .= $child->wholeText;
895 895
                 }
896 896
             } elseif ($child instanceof \DOMComment) {
897
-                $html .= '<!--' . $child->textContent . '-->';
897
+                $html .= '<!--'.$child->textContent.'-->';
898 898
             }
899 899
         }
900 900
 
@@ -1094,8 +1094,8 @@  discard block
 block discarded – undo
1094 1094
         if (\strpos($html, ' ') !== false) {
1095 1095
             $html = (string) \preg_replace_callback(
1096 1096
                 '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#',
1097
-                static function ($matches) {
1098
-                    return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>';
1097
+                static function($matches) {
1098
+                    return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>';
1099 1099
                 },
1100 1100
                 $html
1101 1101
             );
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
         if (\strpos($html, $this->protectedChildNodesHelper) !== false) {
1117 1117
             $html = (string) \preg_replace_callback(
1118
-                '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/',
1118
+                '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/',
1119 1119
                 [$this, 'restoreProtectedHtml'],
1120 1120
                 $html
1121 1121
             );
@@ -1135,14 +1135,14 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
         $html = \str_replace(
1137 1137
             [
1138
-                'html>' . "\n",
1139
-                "\n" . '<html',
1140
-                'html/>' . "\n",
1141
-                "\n" . '</html',
1142
-                'head>' . "\n",
1143
-                "\n" . '<head',
1144
-                'head/>' . "\n",
1145
-                "\n" . '</head',
1138
+                'html>'."\n",
1139
+                "\n".'<html',
1140
+                'html/>'."\n",
1141
+                "\n".'</html',
1142
+                'head>'."\n",
1143
+                "\n".'<head',
1144
+                'head/>'."\n",
1145
+                "\n".'</head',
1146 1146
             ],
1147 1147
             [
1148 1148
                 'html>',
@@ -1161,11 +1161,11 @@  discard block
 block discarded – undo
1161 1161
         $replace = [];
1162 1162
         $replacement = [];
1163 1163
         foreach (self::$selfClosingTags as $selfClosingTag) {
1164
-            $replace[] = '<' . $selfClosingTag . '/>';
1165
-            $replacement[] = '<' . $selfClosingTag . '>';
1166
-            $replace[] = '<' . $selfClosingTag . ' />';
1167
-            $replacement[] = '<' . $selfClosingTag . '>';
1168
-            $replace[] = '></' . $selfClosingTag . '>';
1164
+            $replace[] = '<'.$selfClosingTag.'/>';
1165
+            $replacement[] = '<'.$selfClosingTag.'>';
1166
+            $replace[] = '<'.$selfClosingTag.' />';
1167
+            $replacement[] = '<'.$selfClosingTag.'>';
1168
+            $replace[] = '></'.$selfClosingTag.'>';
1169 1169
             $replacement[] = '>';
1170 1170
         }
1171 1171
         $html = \str_replace(
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
             }
1355 1355
 
1356 1356
             $this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml();
1357
-            $element->getNode()->parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>';
1357
+            $element->getNode()->parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>';
1358 1358
 
1359 1359
             ++$this->protected_tags_counter;
1360 1360
         }
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
             }
1388 1388
 
1389 1389
             $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml;
1390
-            $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>';
1390
+            $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>';
1391 1391
 
1392 1392
             ++$this->protected_tags_counter;
1393 1393
         }
@@ -1404,11 +1404,11 @@  discard block
 block discarded – undo
1404 1404
                 continue;
1405 1405
             }
1406 1406
 
1407
-            $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->';
1407
+            $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->';
1408 1408
 
1409 1409
             /* @var $node \DOMComment */
1410 1410
             $node = $element->getNode();
1411
-            $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>');
1411
+            $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>');
1412 1412
             /** @noinspection UnusedFunctionResultInspection */
1413 1413
             $element->getNode()->parentNode->replaceChild($child, $node);
1414 1414
 
Please login to merge, or discard this patch.