Completed
Push — master ( 4b28b4...37c80b )
by Tim
43:25 queued 28:26
created
Classes/Manipulation/RemoveGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,6 +22,6 @@
 block discarded – undo
22 22
     public function manipulate($html, array $configuration = [])
23 23
     {
24 24
         $regex = '<meta name=["\']?generator["\']? [^>]+>';
25
-        return preg_replace('/' . $regex . '/is', '', $html);
25
+        return preg_replace('/'.$regex.'/is', '', $html);
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
Classes/Service/CleanHtmlService.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
         if (!empty($config)) {
78 78
             if ($config['formatHtml'] && is_numeric($config['formatHtml'])) {
79
-                $this->formatType = (int)$config['formatHtml'];
79
+                $this->formatType = (int) $config['formatHtml'];
80 80
             }
81 81
 
82 82
             if ($config['formatHtml.']['tabSize'] && is_numeric($config['formatHtml.']['tabSize'])) {
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
             }
85 85
 
86 86
             if (isset($config['formatHtml.']['debugComment'])) {
87
-                $this->debugComment = (bool)$config['formatHtml.']['debugComment'];
87
+                $this->debugComment = (bool) $config['formatHtml.']['debugComment'];
88 88
             }
89 89
 
90 90
             if (isset($config['headerComment'])) {
91 91
                 $this->headerComment = $config['headerComment'];
92 92
             }
93 93
 
94
-            if (isset($config['dropEmptySpaceChar']) && (bool)$config['dropEmptySpaceChar']) {
94
+            if (isset($config['dropEmptySpaceChar']) && (bool) $config['dropEmptySpaceChar']) {
95 95
                 $this->emptySpaceChar = '';
96 96
             }
97 97
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     public function clean($html, $config = [])
109 109
     {
110 110
         if (!empty($config)) {
111
-            if ((bool)$config['enabled'] === false) {
111
+            if ((bool) $config['enabled'] === false) {
112 112
                 return $html;
113 113
             }
114 114
 
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 
118 118
         $manipulations = [];
119 119
 
120
-        if (isset($config['removeGenerator']) && (bool)$config['removeGenerator']) {
120
+        if (isset($config['removeGenerator']) && (bool) $config['removeGenerator']) {
121 121
             $manipulations['removeGenerator'] = GeneralUtility::makeInstance(RemoveGenerator::class);
122 122
         }
123 123
 
124
-        if (isset($config['removeComments']) && (bool)$config['removeComments']) {
124
+        if (isset($config['removeComments']) && (bool) $config['removeComments']) {
125 125
             $manipulations['removeComments'] = GeneralUtility::makeInstance(RemoveComments::class);
126 126
         }
127 127
 
128
-        if (isset($config['removeBlurScript']) && (bool)$config['removeBlurScript']) {
128
+        if (isset($config['removeBlurScript']) && (bool) $config['removeBlurScript']) {
129 129
             $manipulations['removeBlurScript'] = GeneralUtility::makeInstance(RemoveBlurScript::class);
130 130
         }
131 131
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         foreach ($manipulations as $key => $manipulation) {
137 137
             /** @var ManipulationInterface $manipulation */
138
-            $configuration = isset($config[$key . '.']) && is_array($config[$key . '.']) ? $config[$key . '.'] : [];
138
+            $configuration = isset($config[$key.'.']) && is_array($config[$key.'.']) ? $config[$key.'.'] : [];
139 139
             $html = $manipulation->manipulate($html, $configuration);
140 140
         }
141 141
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $functionalBoxElements = 'dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr|colgroup';
182 182
         $usableBoxElements = 'applet|button|del|iframe|ins|map|object|script';
183 183
         $imagineBoxElements = 'html|body|head|meta|title|link|script|base|!--';
184
-        $allBoxLikeElements = '(?>' . $trueBoxElements . '|' . $functionalBoxElements . '|' . $usableBoxElements . '|' . $imagineBoxElements . ')';
184
+        $allBoxLikeElements = '(?>'.$trueBoxElements.'|'.$functionalBoxElements.'|'.$usableBoxElements.'|'.$imagineBoxElements.')';
185 185
         $esteticBoxLikeElements = '(?>html|head|body|meta name|title|div|table|h1|h2|h3|h4|h5|h6|p|form|pre|center|!--)';
186 186
         $structureBoxLikeElements = '(?>html|head|body|div|!--)';
187 187
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             '/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/',
191 191
             $html,
192 192
             -1,
193
-            PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
193
+            PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY
194 194
         );
195 195
         // remove empty lines
196 196
         $htmlArray = [''];
@@ -217,52 +217,52 @@  discard block
 block discarded – undo
217 217
             } elseif ($this->formatType == 2 && ( // minimalistic line break
218 218
                     # this element has a line break before itself
219 219
                     preg_match(
220
-                        '/<' . $structureBoxLikeElements . '(.*)>/Usi',
220
+                        '/<'.$structureBoxLikeElements.'(.*)>/Usi',
221 221
                         $htmlArray[$x]
222 222
                     ) || preg_match(
223
-                        '/<' . $structureBoxLikeElements . '(.*) \/>/Usi',
223
+                        '/<'.$structureBoxLikeElements.'(.*) \/>/Usi',
224 224
                         $htmlArray[$x]
225 225
                     ) || # one element before is a element that has a line break after
226 226
                     preg_match(
227
-                        '/<\/' . $structureBoxLikeElements . '(.*)>/Usi',
227
+                        '/<\/'.$structureBoxLikeElements.'(.*)>/Usi',
228 228
                         $htmlArray[$x - 1]
229 229
                     ) || substr(
230 230
                         $htmlArray[$x - 1],
231 231
                         0,
232 232
                         4
233
-                    ) == '<!--' || preg_match('/<' . $structureBoxLikeElements . '(.*) \/>/Usi', $htmlArray[$x - 1]))
233
+                    ) == '<!--' || preg_match('/<'.$structureBoxLikeElements.'(.*) \/>/Usi', $htmlArray[$x - 1]))
234 234
             ) {
235 235
                 $newline = true;
236 236
             } elseif ($this->formatType == 3 && ( // aestetic line break
237 237
                     # this element has a line break before itself
238 238
                     preg_match(
239
-                        '/<' . $esteticBoxLikeElements . '(.*)>/Usi',
239
+                        '/<'.$esteticBoxLikeElements.'(.*)>/Usi',
240 240
                         $htmlArray[$x]
241 241
                     ) || preg_match(
242
-                        '/<' . $esteticBoxLikeElements . '(.*) \/>/Usi',
242
+                        '/<'.$esteticBoxLikeElements.'(.*) \/>/Usi',
243 243
                         $htmlArray[$x]
244 244
                     ) || # one element before is a element that has a line break after
245
-                    preg_match('/<\/' . $esteticBoxLikeElements . '(.*)>/Usi', $htmlArray[$x - 1]) || substr(
245
+                    preg_match('/<\/'.$esteticBoxLikeElements.'(.*)>/Usi', $htmlArray[$x - 1]) || substr(
246 246
                         $htmlArray[$x - 1],
247 247
                         0,
248 248
                         4
249
-                    ) == '<!--' || preg_match('/<' . $esteticBoxLikeElements . '(.*) \/>/Usi', $htmlArray[$x - 1]))
249
+                    ) == '<!--' || preg_match('/<'.$esteticBoxLikeElements.'(.*) \/>/Usi', $htmlArray[$x - 1]))
250 250
             ) {
251 251
                 $newline = true;
252 252
             } elseif ($this->formatType >= 4 && ( // logical line break
253 253
                     # this element has a line break before itself
254 254
                     preg_match(
255
-                        '/<' . $allBoxLikeElements . '(.*)>/Usi',
255
+                        '/<'.$allBoxLikeElements.'(.*)>/Usi',
256 256
                         $htmlArray[$x]
257 257
                     ) || preg_match(
258
-                        '/<' . $allBoxLikeElements . '(.*) \/>/Usi',
258
+                        '/<'.$allBoxLikeElements.'(.*) \/>/Usi',
259 259
                         $htmlArray[$x]
260 260
                     ) || # one element before is a element that has a line break after
261
-                    preg_match('/<\/' . $allBoxLikeElements . '(.*)>/Usi', $htmlArray[$x - 1]) || substr(
261
+                    preg_match('/<\/'.$allBoxLikeElements.'(.*)>/Usi', $htmlArray[$x - 1]) || substr(
262 262
                         $htmlArray[$x - 1],
263 263
                         0,
264 264
                         4
265
-                    ) == '<!--' || preg_match('/<' . $allBoxLikeElements . '(.*) \/>/Usi', $htmlArray[$x - 1]))
265
+                    ) == '<!--' || preg_match('/<'.$allBoxLikeElements.'(.*) \/>/Usi', $htmlArray[$x - 1]))
266 266
             ) {
267 267
                 $newline = true;
268 268
             }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
         // include debug comment at the end
341 341
         if ($tabs != 0 && $this->debugComment === true) {
342
-            $html .= '<!--' . $tabs . " open elements found-->\r\n";
342
+            $html .= '<!--'.$tabs." open elements found-->\r\n";
343 343
         }
344 344
 
345 345
         return $html;
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             'textarea',
471 471
             'pre'
472 472
         ]; // eventuell auch: span, script, style
473
-        $peaces = preg_split('#(<(' . implode('|', $splitArray) . ').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
473
+        $peaces = preg_split('#(<('.implode('|', $splitArray).').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
474 474
         $html = "";
475 475
         for ($i = 0; $i < count($peaces); $i++) {
476 476
             if (($i + 1) % 3 == 0) {
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
     public function includeHeaderComment(&$html)
525 525
     {
526 526
         if (!empty($this->headerComment)) {
527
-            $html = preg_replace_callback('/<meta http-equiv(.*)>/Usi', function ($matches) {
528
-                return trim($matches[0] . $this->newline . $this->tab . $this->tab . '<!-- ' . $this->headerComment . '-->');
527
+            $html = preg_replace_callback('/<meta http-equiv(.*)>/Usi', function($matches) {
528
+                return trim($matches[0].$this->newline.$this->tab.$this->tab.'<!-- '.$this->headerComment.'-->');
529 529
             }, $html, 1);
530 530
         }
531 531
     }
Please login to merge, or discard this patch.