Completed
Push — master ( 4c8d1b...53ea1e )
by Tim
12:22
created
Classes/Manipulation/RemoveGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
     {
17 17
         $regex = '<meta name=["\']?generator["\']? [^>]+>';
18 18
 
19
-        return (string) preg_replace('/' . $regex . '/is', '', $html);
19
+        return (string) preg_replace('/'.$regex.'/is', '', $html);
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
Classes/Service/RegExRepService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
         foreach (['search.', 'replace.'] as $section) {
24 24
             if (!isset($config[$section]) || !\is_array($config[$section])) {
25
-                throw new \Exception('missing entry @ config.replacer.' . $section);
25
+                throw new \Exception('missing entry @ config.replacer.'.$section);
26 26
             }
27 27
 
28 28
             if (preg_match_all('/"([\w\-]+)\.";/', serialize(array_keys($config[$section])), $matches)) {
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
                     $config[$section][$key] = $cObj
33 33
                         ->stdWrap(
34 34
                             $config[$section][$key],
35
-                            $config[$section][$key . '.']
35
+                            $config[$section][$key.'.']
36 36
                         )
37 37
                     ;
38
-                    unset($config[$section][$key . '.']); // keep!
38
+                    unset($config[$section][$key.'.']); // keep!
39 39
                 }
40 40
             }
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         if (Environment::getContext()->isDevelopment()) {
46 46
             foreach ($config['search.'] as $key => $val) {
47 47
                 if (false === @preg_match($val, '')) {
48
-                    throw new \Exception(preg_last_error_msg() . ' : please check your regex syntax @ ' . "{$key} = {$val}");
48
+                    throw new \Exception(preg_last_error_msg().' : please check your regex syntax @ '."{$key} = {$val}");
49 49
                 }
50 50
             }
51 51
         }
Please login to merge, or discard this patch.
Classes/Service/SvgStoreService.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
         $this->svgFileArr = $this->svgCache->get('svgFileArr') ?: [];
67 67
 
68 68
         if (empty($this->spritePath) && !$this->populateCache()) {
69
-            throw new \Exception('could not write file: ' . $this->sitePath . $this->spritePath);
69
+            throw new \Exception('could not write file: '.$this->sitePath.$this->spritePath);
70 70
         }
71 71
 
72
-        if (!file_exists($this->sitePath . $this->spritePath)) {
73
-            throw new \Exception('file does not exists: ' . $this->sitePath . $this->spritePath);
72
+        if (!file_exists($this->sitePath.$this->spritePath)) {
73
+            throw new \Exception('file does not exists: '.$this->sitePath.$this->spritePath);
74 74
         }
75 75
     }
76 76
 
@@ -87,26 +87,26 @@  discard block
 block discarded – undo
87 87
         }
88 88
 
89 89
         // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes
90
-        $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function (array $match): string { // ^[/]
90
+        $dom['body'] = preg_replace_callback('/<img(?<pre>[^>]*)src="(?:https?:)?(?:\/\/[^\/]+?)?(?<src>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?!\s*<\/picture>)/s', function(array $match): string { // ^[/]
91 91
             if (!isset($this->svgFileArr[$match['src']])) { // check usage
92 92
                 return $match[0];
93 93
             }
94
-            $attr = preg_replace('/\s(?:alt|ismap|loading|title|sizes|srcset|usemap|crossorigin|decoding|fetchpriority|referrerpolicy)="[^"]*"/', '', $match['pre'] . $match['post']); // cleanup
94
+            $attr = preg_replace('/\s(?:alt|ismap|loading|title|sizes|srcset|usemap|crossorigin|decoding|fetchpriority|referrerpolicy)="[^"]*"/', '', $match['pre'].$match['post']); // cleanup
95 95
 
96 96
             return \sprintf('<svg %s %s><use href="%s#%s"/></svg>', $this->svgFileArr[$match['src']]['attr'], trim($attr), $this->spritePath, $this->convertFilePath($match['src']));
97 97
         }, $dom['body']);
98 98
 
99 99
         // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object#attributes
100
-        $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function (array $match): string { // ^[/]
100
+        $dom['body'] = preg_replace_callback('/<object(?<pre>[^>]*)data="(?<data>\/[^"]+\.svg)"(?<post>[^>]*?)[\s\/]*>(?:<\/object>)/s', function(array $match): string { // ^[/]
101 101
             if (!isset($this->svgFileArr[$match['data']])) { // check usage
102 102
                 return $match[0];
103 103
             }
104
-            $attr = preg_replace('/\s(?:form|name|type|usemap)="[^"]*"/', '', $match['pre'] . $match['post']); // cleanup
104
+            $attr = preg_replace('/\s(?:form|name|type|usemap)="[^"]*"/', '', $match['pre'].$match['post']); // cleanup
105 105
 
106 106
             return \sprintf('<svg %s %s><use href="%s#%s"/></svg>', $this->svgFileArr[$match['data']]['attr'], trim($attr), $this->spritePath, $this->convertFilePath($match['data']));
107 107
         }, $dom['body']);
108 108
 
109
-        return $dom['head'] . $dom['body'];
109
+        return $dom['head'].$dom['body'];
110 110
     }
111 111
 
112 112
     private function convertFilePath(string $path): string
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 
117 117
     private function addFileToSpriteArr(string $hash, string $path, array $attr = []): ?array
118 118
     {
119
-        if (!file_exists($this->sitePath . $path)) {
119
+        if (!file_exists($this->sitePath.$path)) {
120 120
             return null;
121 121
         }
122 122
 
123
-        $svg = file_get_contents($this->sitePath . $path);
123
+        $svg = file_get_contents($this->sitePath.$path);
124 124
 
125 125
         if (preg_match('/(?:;base64|i:a?i?pgf)/', $svg)) { // noop!
126 126
             return null;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         // }, $svg);
151 151
 
152 152
         // https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg#attributes
153
-        $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function (array $match) use (&$attr): string {
153
+        $svg = preg_replace_callback('/([^>]*)\s*(?=>)/s', function(array $match) use (&$attr): string {
154 154
             if (false === preg_match_all('/(?!\s)(?<attr>[a-z\-]+)="\s*(?<value>[^"]+)\s*"/i', $match[1], $matches)) {
155 155
                 return $match[0];
156 156
             }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
         $fileArr = GeneralUtility::makeInstance(SvgFileRepository::class)->findAllByStorageUids(array_keys($storageArr));
199 199
         foreach ($fileArr as $file) {
200
-            $file['path'] = '/' . $storageArr[$file['storage']] . $file['identifier']; // ^[/]
200
+            $file['path'] = '/'.$storageArr[$file['storage']].$file['identifier']; // ^[/]
201 201
             $file['defs'] = $this->addFileToSpriteArr($file['sha1'], $file['path']);
202 202
 
203 203
             if (null !== $file['defs']) {
@@ -211,17 +211,17 @@  discard block
 block discarded – undo
211 211
 
212 212
         $svg = preg_replace_callback(
213 213
             '/<use(?<pre>.*?)(?:xlink:)?href="(?<href>\/.+?\.svg)(?:#[^"]*?)?"(?<post>.*?)[\s\/]*>(?:<\/use>)?/s',
214
-            function (array $match): string {
214
+            function(array $match): string {
215 215
                 if (!isset($this->svgFileArr[$match['href']])) { // check usage
216 216
                     return $match[0];
217 217
                 }
218 218
 
219
-                return \sprintf('<use%s href="#%s"/>', $match['pre'] . $match['post'], $this->convertFilePath($match['href']));
219
+                return \sprintf('<use%s href="#%s"/>', $match['pre'].$match['post'], $this->convertFilePath($match['href']));
220 220
             },
221 221
             '<svg xmlns="http://www.w3.org/2000/svg">'
222 222
             // ."\n<style>\n".implode("\n", $this->styl)."\n</style>"
223 223
             // ."\n<defs>\n".implode("\n", $this->defs)."\n</defs>"
224
-            . "\n<symbol " . implode("</symbol>\n<symbol ", $this->svgs) . "</symbol>\n"
224
+            . "\n<symbol ".implode("</symbol>\n<symbol ", $this->svgs)."</symbol>\n"
225 225
             . '</svg>'
226 226
         );
227 227
 
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
         $svg = preg_replace('/<([a-z\-]+)\s*(\/|>\s*<\/\1)>\s*|\s+(?=\/>)/i', '', $svg); // remove emtpy TAGs & shorten endings
235 235
         $svg = preg_replace('/<((circle|ellipse|line|path|polygon|polyline|rect|stop|use)\s[^>]+?)\s*>\s*<\/\2>/', '<$1/>', $svg); // shorten/minify TAG syntax
236 236
 
237
-        if (!is_dir($this->sitePath . $this->outputDir)) {
238
-            GeneralUtility::mkdir_deep($this->sitePath . $this->outputDir);
237
+        if (!is_dir($this->sitePath.$this->outputDir)) {
238
+            GeneralUtility::mkdir_deep($this->sitePath.$this->outputDir);
239 239
         }
240 240
 
241
-        $this->spritePath = $this->outputDir . hash('sha1', serialize($this->svgFileArr)) . '.svg';
242
-        if (false === file_put_contents($this->sitePath . $this->spritePath, $svg)) {
241
+        $this->spritePath = $this->outputDir.hash('sha1', serialize($this->svgFileArr)).'.svg';
242
+        if (false === file_put_contents($this->sitePath.$this->spritePath, $svg)) {
243 243
             return false;
244 244
         }
245 245
 
Please login to merge, or discard this patch.
Classes/Service/CleanHtmlService.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         foreach ($manipulations as $key => $manipulation) {
103 103
             /** @var ManipulationInterface $manipulation */
104
-            $configuration = isset($config[$key . '.']) && \is_array($config[$key . '.']) ? $config[$key . '.'] : [];
104
+            $configuration = isset($config[$key.'.']) && \is_array($config[$key.'.']) ? $config[$key.'.'] : [];
105 105
             $html = $manipulation->manipulate($html, $configuration);
106 106
         }
107 107
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $functionalBoxElements = 'dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr|colgroup';
162 162
         $usableBoxElements = 'applet|button|del|iframe|ins|map|object|script';
163 163
         $imagineBoxElements = 'html|body|head|meta|title|link|script|base|!--';
164
-        $allBoxLikeElements = '(?>' . $trueBoxElements . '|' . $functionalBoxElements . '|' . $usableBoxElements . '|' . $imagineBoxElements . ')';
164
+        $allBoxLikeElements = '(?>'.$trueBoxElements.'|'.$functionalBoxElements.'|'.$usableBoxElements.'|'.$imagineBoxElements.')';
165 165
         $esteticBoxLikeElements = '(?>html|head|body|meta name|title|div|table|h1|h2|h3|h4|h5|h6|p|form|pre|center|!--)';
166 166
         $structureBoxLikeElements = '(?>html|head|body|div|!--)';
167 167
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             '/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/',
171 171
             $html,
172 172
             -1,
173
-            \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY
173
+            \PREG_SPLIT_DELIM_CAPTURE|\PREG_SPLIT_NO_EMPTY
174 174
         );
175 175
 
176 176
         if (false === $htmlArrayTemp) {
@@ -204,52 +204,52 @@  discard block
 block discarded – undo
204 204
             } elseif (2 == $this->formatType && ( // minimalistic line break
205 205
                 // this element has a line break before itself
206 206
                 preg_match(
207
-                    '/<' . $structureBoxLikeElements . '(.*)>/Usi',
207
+                    '/<'.$structureBoxLikeElements.'(.*)>/Usi',
208 208
                     $htmlArrayCurrent
209 209
                 ) || preg_match(
210
-                    '/<' . $structureBoxLikeElements . '(.*) \/>/Usi',
210
+                    '/<'.$structureBoxLikeElements.'(.*) \/>/Usi',
211 211
                     $htmlArrayCurrent
212 212
                 ) // one element before is a element that has a line break after
213 213
                 || preg_match(
214
-                    '/<\/' . $structureBoxLikeElements . '(.*)>/Usi',
214
+                    '/<\/'.$structureBoxLikeElements.'(.*)>/Usi',
215 215
                     $htmlArrayBefore
216 216
                 ) || '<!--' == substr(
217 217
                     $htmlArrayBefore,
218 218
                     0,
219 219
                     4
220
-                ) || preg_match('/<' . $structureBoxLikeElements . '(.*) \/>/Usi', $htmlArrayBefore))
220
+                ) || preg_match('/<'.$structureBoxLikeElements.'(.*) \/>/Usi', $htmlArrayBefore))
221 221
             ) {
222 222
                 $newline = true;
223 223
             } elseif (3 == $this->formatType && ( // aestetic line break
224 224
                 // this element has a line break before itself
225 225
                 preg_match(
226
-                    '/<' . $esteticBoxLikeElements . '(.*)>/Usi',
226
+                    '/<'.$esteticBoxLikeElements.'(.*)>/Usi',
227 227
                     $htmlArrayCurrent
228 228
                 ) || preg_match(
229
-                    '/<' . $esteticBoxLikeElements . '(.*) \/>/Usi',
229
+                    '/<'.$esteticBoxLikeElements.'(.*) \/>/Usi',
230 230
                     $htmlArrayCurrent
231 231
                 ) // one element before is a element that has a line break after
232
-                || preg_match('/<\/' . $esteticBoxLikeElements . '(.*)>/Usi', $htmlArrayBefore) || '<!--' == substr(
232
+                || preg_match('/<\/'.$esteticBoxLikeElements.'(.*)>/Usi', $htmlArrayBefore) || '<!--' == substr(
233 233
                     $htmlArrayBefore,
234 234
                     0,
235 235
                     4
236
-                ) || preg_match('/<' . $esteticBoxLikeElements . '(.*) \/>/Usi', $htmlArrayBefore))
236
+                ) || preg_match('/<'.$esteticBoxLikeElements.'(.*) \/>/Usi', $htmlArrayBefore))
237 237
             ) {
238 238
                 $newline = true;
239 239
             } elseif ($this->formatType >= 4 && ( // logical line break
240 240
                 // this element has a line break before itself
241 241
                 preg_match(
242
-                    '/<' . $allBoxLikeElements . '(.*)>/Usi',
242
+                    '/<'.$allBoxLikeElements.'(.*)>/Usi',
243 243
                     $htmlArrayCurrent
244 244
                 ) || preg_match(
245
-                    '/<' . $allBoxLikeElements . '(.*) \/>/Usi',
245
+                    '/<'.$allBoxLikeElements.'(.*) \/>/Usi',
246 246
                     $htmlArrayCurrent
247 247
                 ) // one element before is a element that has a line break after
248
-                || preg_match('/<\/' . $allBoxLikeElements . '(.*)>/Usi', $htmlArrayBefore) || '<!--' == substr(
248
+                || preg_match('/<\/'.$allBoxLikeElements.'(.*)>/Usi', $htmlArrayBefore) || '<!--' == substr(
249 249
                     $htmlArrayBefore,
250 250
                     0,
251 251
                     4
252
-                ) || preg_match('/<' . $allBoxLikeElements . '(.*) \/>/Usi', $htmlArrayBefore))
252
+                ) || preg_match('/<'.$allBoxLikeElements.'(.*) \/>/Usi', $htmlArrayBefore))
253 253
             ) {
254 254
                 $newline = true;
255 255
             }
@@ -385,6 +385,6 @@  discard block
 block discarded – undo
385 385
      */
386 386
     public function includeHeaderComment(string &$html): void
387 387
     {
388
-        $html = preg_replace('/^(-->)$/m', "\n\t" . $this->headerComment . "\n$1", $html);
388
+        $html = preg_replace('/^(-->)$/m', "\n\t".$this->headerComment."\n$1", $html);
389 389
     }
390 390
 }
Please login to merge, or discard this patch.