Completed
Push — master ( 3a7ed1...6676dd )
by Lars
01:49
created
src/voku/helper/HtmlMin.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1175,8 +1175,8 @@
 block discarded – undo
1175 1175
     }
1176 1176
 
1177 1177
     /**
1178
-     * @param $html
1179
-     * @param $decodeUtf8Specials
1178
+     * @param string $html
1179
+     * @param boolean $decodeUtf8Specials
1180 1180
      *
1181 1181
      * @return string
1182 1182
      */
Please login to merge, or discard this patch.
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -736,184 +736,184 @@  discard block
 block discarded – undo
736 736
         return \in_array($tag_name, self::$optional_end_tags, true)
737 737
                ||
738 738
                (
739
-                   $tag_name === 'li'
739
+                    $tag_name === 'li'
740 740
                    &&
741 741
                    (
742
-                       $nextSibling === null
742
+                        $nextSibling === null
743 743
                        ||
744 744
                        (
745
-                           $nextSibling instanceof \DOMElement
745
+                            $nextSibling instanceof \DOMElement
746 746
                            &&
747 747
                            $nextSibling->tagName === 'li'
748
-                       )
749
-                   )
750
-               )
748
+                        )
749
+                    )
750
+                )
751 751
                ||
752 752
                (
753
-                   (
754
-                       $tag_name === 'rp'
755
-                   )
753
+                    (
754
+                        $tag_name === 'rp'
755
+                    )
756 756
                    &&
757 757
                    (
758
-                       $nextSibling === null
758
+                        $nextSibling === null
759 759
                        ||
760 760
                        (
761
-                           $nextSibling instanceof \DOMElement
761
+                            $nextSibling instanceof \DOMElement
762 762
                            &&
763 763
                            (
764
-                               $nextSibling->tagName === 'rp'
764
+                                $nextSibling->tagName === 'rp'
765 765
                                ||
766 766
                                $nextSibling->tagName === 'rt'
767
-                           )
768
-                       )
769
-                   )
770
-               )
767
+                            )
768
+                        )
769
+                    )
770
+                )
771 771
                ||
772 772
                (
773
-                   $tag_name === 'tr'
773
+                    $tag_name === 'tr'
774 774
                    &&
775 775
                    (
776
-                       $nextSibling === null
776
+                        $nextSibling === null
777 777
                        ||
778 778
                        (
779
-                           $nextSibling instanceof \DOMElement
779
+                            $nextSibling instanceof \DOMElement
780 780
                            &&
781 781
                            $nextSibling->tagName === 'tr'
782
-                       )
783
-                   )
784
-               )
782
+                        )
783
+                    )
784
+                )
785 785
                ||
786 786
                (
787
-                   (
788
-                       $tag_name === 'td'
787
+                    (
788
+                        $tag_name === 'td'
789 789
                        ||
790 790
                        $tag_name === 'th'
791
-                   )
791
+                    )
792 792
                    &&
793 793
                    (
794
-                       $nextSibling === null
794
+                        $nextSibling === null
795 795
                        ||
796 796
                        (
797
-                           $nextSibling instanceof \DOMElement
797
+                            $nextSibling instanceof \DOMElement
798 798
                            &&
799 799
                            (
800
-                               $nextSibling->tagName === 'td'
800
+                                $nextSibling->tagName === 'td'
801 801
                                ||
802 802
                                $nextSibling->tagName === 'th'
803
-                           )
804
-                       )
805
-                   )
806
-               )
803
+                            )
804
+                        )
805
+                    )
806
+                )
807 807
                ||
808 808
                (
809
-                   (
810
-                       $tag_name === 'dd'
809
+                    (
810
+                        $tag_name === 'dd'
811 811
                        ||
812 812
                        $tag_name === 'dt'
813
-                   )
813
+                    )
814 814
                    &&
815 815
                    (
816
-                       (
817
-                           $nextSibling === null
816
+                        (
817
+                            $nextSibling === null
818 818
                            &&
819 819
                            $tag_name === 'dd'
820
-                       )
820
+                        )
821 821
                        ||
822 822
                        (
823
-                           $nextSibling instanceof \DOMElement
823
+                            $nextSibling instanceof \DOMElement
824 824
                            &&
825 825
                            (
826
-                               $nextSibling->tagName === 'dd'
826
+                                $nextSibling->tagName === 'dd'
827 827
                                ||
828 828
                                $nextSibling->tagName === 'dt'
829
-                           )
830
-                       )
831
-                   )
832
-               )
829
+                            )
830
+                        )
831
+                    )
832
+                )
833 833
                ||
834 834
                (
835
-                   $tag_name === 'option'
835
+                    $tag_name === 'option'
836 836
                    &&
837 837
                    (
838
-                       $nextSibling === null
838
+                        $nextSibling === null
839 839
                        ||
840 840
                        (
841
-                           $nextSibling instanceof \DOMElement
841
+                            $nextSibling instanceof \DOMElement
842 842
                            &&
843 843
                            (
844
-                               $nextSibling->tagName === 'option'
844
+                                $nextSibling->tagName === 'option'
845 845
                                ||
846 846
                                $nextSibling->tagName === 'optgroup'
847
-                           )
848
-                       )
849
-                   )
850
-               )
847
+                            )
848
+                        )
849
+                    )
850
+                )
851 851
                ||
852 852
                (
853
-                   $tag_name === 'p'
853
+                    $tag_name === 'p'
854 854
                    &&
855 855
                    (
856
-                       (
857
-                           $nextSibling === null
856
+                        (
857
+                            $nextSibling === null
858 858
                            &&
859 859
                            (
860
-                               $node->parentNode !== null
860
+                                $node->parentNode !== null
861 861
                                &&
862 862
                                !\in_array(
863
-                                   $node->parentNode->nodeName,
864
-                                   [
865
-                                       'a',
866
-                                       'audio',
867
-                                       'del',
868
-                                       'ins',
869
-                                       'map',
870
-                                       'noscript',
871
-                                       'video',
872
-                                   ],
873
-                                   true
874
-                               )
875
-                           )
876
-                       )
863
+                                    $node->parentNode->nodeName,
864
+                                    [
865
+                                        'a',
866
+                                        'audio',
867
+                                        'del',
868
+                                        'ins',
869
+                                        'map',
870
+                                        'noscript',
871
+                                        'video',
872
+                                    ],
873
+                                    true
874
+                                )
875
+                            )
876
+                        )
877 877
                        ||
878 878
                        (
879
-                           $nextSibling instanceof \DOMElement
879
+                            $nextSibling instanceof \DOMElement
880 880
                            &&
881 881
                            \in_array(
882
-                               $nextSibling->tagName,
883
-                               [
884
-                                   'address',
885
-                                   'article',
886
-                                   'aside',
887
-                                   'blockquote',
888
-                                   'dir',
889
-                                   'div',
890
-                                   'dl',
891
-                                   'fieldset',
892
-                                   'footer',
893
-                                   'form',
894
-                                   'h1',
895
-                                   'h2',
896
-                                   'h3',
897
-                                   'h4',
898
-                                   'h5',
899
-                                   'h6',
900
-                                   'header',
901
-                                   'hgroup',
902
-                                   'hr',
903
-                                   'menu',
904
-                                   'nav',
905
-                                   'ol',
906
-                                   'p',
907
-                                   'pre',
908
-                                   'section',
909
-                                   'table',
910
-                                   'ul',
911
-                               ],
912
-                               true
913
-                           )
914
-                       )
915
-                   )
916
-               );
882
+                                $nextSibling->tagName,
883
+                                [
884
+                                    'address',
885
+                                    'article',
886
+                                    'aside',
887
+                                    'blockquote',
888
+                                    'dir',
889
+                                    'div',
890
+                                    'dl',
891
+                                    'fieldset',
892
+                                    'footer',
893
+                                    'form',
894
+                                    'h1',
895
+                                    'h2',
896
+                                    'h3',
897
+                                    'h4',
898
+                                    'h5',
899
+                                    'h6',
900
+                                    'header',
901
+                                    'hgroup',
902
+                                    'hr',
903
+                                    'menu',
904
+                                    'nav',
905
+                                    'ol',
906
+                                    'p',
907
+                                    'pre',
908
+                                    'section',
909
+                                    'table',
910
+                                    'ul',
911
+                                ],
912
+                                true
913
+                            )
914
+                        )
915
+                    )
916
+                );
917 917
     }
918 918
 
919 919
     protected function domNodeToString(\DOMNode $node): string
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
                     }
946 946
 
947 947
                     $html .= '<!DOCTYPE ' . $child->name . ''
948
-                             . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
949
-                             . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
950
-                             . '>';
948
+                              . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
949
+                              . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
950
+                              . '>';
951 951
                 }
952 952
             } elseif ($child instanceof \DOMElement) {
953 953
                 $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child));
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
                               \preg_match('/["\'=<>` \t\r\n\f]+/', $attribute->value) === 0;
684 684
 
685 685
                 $attr_val = $attribute->value;
686
-                $attrstr .= ($omitquotes ? '' : '"') . $attr_val . ($omitquotes ? '' : '"');
686
+                $attrstr .= ($omitquotes ? '' : '"').$attr_val.($omitquotes ? '' : '"');
687 687
                 $attrstr .= ' ';
688 688
             }
689 689
         }
@@ -944,21 +944,21 @@  discard block
 block discarded – undo
944 944
                         $tmpTypePublic = 'PUBLIC';
945 945
                     }
946 946
 
947
-                    $html .= '<!DOCTYPE ' . $child->name . ''
948
-                             . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '')
949
-                             . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '')
947
+                    $html .= '<!DOCTYPE '.$child->name.''
948
+                             . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '')
949
+                             . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '')
950 950
                              . '>';
951 951
                 }
952 952
             } elseif ($child instanceof \DOMElement) {
953
-                $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child));
954
-                $html .= '>' . $this->domNodeToString($child);
953
+                $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child));
954
+                $html .= '>'.$this->domNodeToString($child);
955 955
 
956 956
                 if (
957 957
                     $this->doRemoveOmittedHtmlTags === false
958 958
                     ||
959 959
                     !$this->domNodeClosingTagOptional($child)
960 960
                 ) {
961
-                    $html .= '</' . $child->tagName . '>';
961
+                    $html .= '</'.$child->tagName.'>';
962 962
                 }
963 963
 
964 964
                 if ($this->doRemoveWhitespaceAroundTags === false) {
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
                     $html .= $child->wholeText;
998 998
                 }
999 999
             } elseif ($child instanceof \DOMComment) {
1000
-                $html .= '<!--' . $child->textContent . '-->';
1000
+                $html .= '<!--'.$child->textContent.'-->';
1001 1001
             }
1002 1002
         }
1003 1003
 
@@ -1089,8 +1089,8 @@  discard block
 block discarded – undo
1089 1089
         // Remove extra white-space(s) between HTML attribute(s)
1090 1090
         $html = (string) \preg_replace_callback(
1091 1091
             '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#',
1092
-            function ($matches) {
1093
-                return '<' . $matches[1] . (string) \preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]) . $matches[3] . '>';
1092
+            function($matches) {
1093
+                return '<'.$matches[1].(string) \preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]).$matches[3].'>';
1094 1094
             },
1095 1095
             $html
1096 1096
         );
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
         // -------------------------------------------------------------------------
1106 1106
 
1107 1107
         $html = (string) \preg_replace_callback(
1108
-            '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/',
1108
+            '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/',
1109 1109
             [$this, 'restoreProtectedHtml'],
1110 1110
             $html
1111 1111
         );
@@ -1124,14 +1124,14 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
         $html = \str_replace(
1126 1126
             [
1127
-                'html>' . "\n",
1128
-                "\n" . '<html',
1129
-                'html/>' . "\n",
1130
-                "\n" . '</html',
1131
-                'head>' . "\n",
1132
-                "\n" . '<head',
1133
-                'head/>' . "\n",
1134
-                "\n" . '</head',
1127
+                'html>'."\n",
1128
+                "\n".'<html',
1129
+                'html/>'."\n",
1130
+                "\n".'</html',
1131
+                'head>'."\n",
1132
+                "\n".'<head',
1133
+                'head/>'."\n",
1134
+                "\n".'</head',
1135 1135
             ],
1136 1136
             [
1137 1137
                 'html>',
@@ -1150,10 +1150,10 @@  discard block
 block discarded – undo
1150 1150
         $replace = [];
1151 1151
         $replacement = [];
1152 1152
         foreach (self::$selfClosingTags as $selfClosingTag) {
1153
-            $replace[] = '<' . $selfClosingTag . '/>';
1154
-            $replacement[] = '<' . $selfClosingTag . '>';
1155
-            $replace[] = '<' . $selfClosingTag . ' />';
1156
-            $replacement[] = '<' . $selfClosingTag . '>';
1153
+            $replace[] = '<'.$selfClosingTag.'/>';
1154
+            $replacement[] = '<'.$selfClosingTag.'>';
1155
+            $replace[] = '<'.$selfClosingTag.' />';
1156
+            $replacement[] = '<'.$selfClosingTag.'>';
1157 1157
         }
1158 1158
         $html = \str_replace(
1159 1159
             $replace,
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
             $html
1162 1162
         );
1163 1163
 
1164
-        $html = (string) \preg_replace('#<\b(' . $CACHE_SELF_CLOSING_TAGS . ')([^>]*+)><\/\b\1>#', '<\\1\\2>', $html);
1164
+        $html = (string) \preg_replace('#<\b('.$CACHE_SELF_CLOSING_TAGS.')([^>]*+)><\/\b\1>#', '<\\1\\2>', $html);
1165 1165
 
1166 1166
         // ------------------------------------
1167 1167
         // check if compression worked
@@ -1268,14 +1268,14 @@  discard block
 block discarded – undo
1268 1268
             }
1269 1269
 
1270 1270
             $this->protectedChildNodes[$counter] = $element->text();
1271
-            $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>';
1271
+            $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>';
1272 1272
 
1273 1273
             ++$counter;
1274 1274
         }
1275 1275
 
1276 1276
         foreach ($dom->find('code, nocompress') as $element) {
1277 1277
             $this->protectedChildNodes[$counter] = $element->parentNode()->innerHtml();
1278
-            $element->getNode()->parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>';
1278
+            $element->getNode()->parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>';
1279 1279
 
1280 1280
             ++$counter;
1281 1281
         }
@@ -1288,11 +1288,11 @@  discard block
 block discarded – undo
1288 1288
                 continue;
1289 1289
             }
1290 1290
 
1291
-            $this->protectedChildNodes[$counter] = '<!--' . $text . '-->';
1291
+            $this->protectedChildNodes[$counter] = '<!--'.$text.'-->';
1292 1292
 
1293 1293
             /* @var $node \DOMComment */
1294 1294
             $node = $element->getNode();
1295
-            $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>');
1295
+            $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>');
1296 1296
             /** @noinspection UnusedFunctionResultInspection */
1297 1297
             $element->getNode()->parentNode->replaceChild($child, $node);
1298 1298
 
Please login to merge, or discard this patch.
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.