@@ -26,8 +26,8 @@ |
||
26 | 26 | $it = new \RecursiveDirectoryIterator($filename_clean, \RecursiveDirectoryIterator::SKIP_DOTS); |
27 | 27 | $files = new \RecursiveIteratorIterator($it, |
28 | 28 | \RecursiveIteratorIterator::CHILD_FIRST); |
29 | - foreach($files as $file) { |
|
30 | - if ($file->isDir()){ |
|
29 | + foreach ($files as $file) { |
|
30 | + if ($file->isDir()) { |
|
31 | 31 | rmdir($file->getRealPath()); |
32 | 32 | } else { |
33 | 33 | unlink($file->getRealPath()); |
@@ -352,7 +352,7 @@ |
||
352 | 352 | $settingItem->addChild('type', $type); |
353 | 353 | if ($variants) { |
354 | 354 | $variantsElement = $settingItem->addChild('variants'); |
355 | - foreach($variants as $variant) |
|
355 | + foreach ($variants as $variant) |
|
356 | 356 | { |
357 | 357 | $variantElement = $variantsElement->addChild('item'); |
358 | 358 | $variantElement->addAttribute('id', $variant); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $key = $matches[1]; |
55 | 55 | $value = true; |
56 | 56 | |
57 | - switch(count($matches)) { |
|
57 | + switch (count($matches)) { |
|
58 | 58 | case 4: |
59 | 59 | case 5: |
60 | 60 | $value = $matches[3]; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $input = ''; |
29 | 29 | } else { |
30 | 30 | $pos = strpos($input, '/'); |
31 | - if ($pos === 0) $pos = strpos($input, '/', $pos+1); |
|
31 | + if ($pos === 0) $pos = strpos($input, '/', $pos + 1); |
|
32 | 32 | if ($pos === false) $pos = strlen($input); |
33 | 33 | $output .= substr($input, 0, $pos); |
34 | 34 | $input = (string) substr($input, $pos); |
@@ -10,9 +10,9 @@ |
||
10 | 10 | /** |
11 | 11 | * autoload |
12 | 12 | */ |
13 | -spl_autoload_register(function ($class) { |
|
13 | +spl_autoload_register(function($class) { |
|
14 | 14 | $file = realpath(__DIR__ . '/' . 'app') . '/' . str_replace('\\', '/', $class) . '.php'; |
15 | - if(file_exists($file)) { |
|
15 | + if (file_exists($file)) { |
|
16 | 16 | require_once($file); |
17 | 17 | } |
18 | 18 | }); |
@@ -228,7 +228,7 @@ |
||
228 | 228 | |
229 | 229 | public function setSettingsItemAutocomplete() |
230 | 230 | { |
231 | - $generator = $this->mfGenerator |
|
231 | + $generator = $this->mfGenerator |
|
232 | 232 | ->find(AddonXmlGenerator::class) |
233 | 233 | ->extract(); |
234 | 234 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $self->set($key, $setting); |
14 | 14 | }); |
15 | 15 | |
16 | - foreach($arguments as $key => $value) { |
|
16 | + foreach ($arguments as $key => $value) { |
|
17 | 17 | $this->set($key, $value); |
18 | 18 | } |
19 | 19 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function getOr(string ...$keys) |
37 | 37 | { |
38 | - foreach($keys as $key) { |
|
38 | + foreach ($keys as $key) { |
|
39 | 39 | $value = $this->get($key); |
40 | 40 | |
41 | 41 | if ($value) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @codeCoverageIgnore |
19 | 19 | * Third party library |
20 | 20 | */ |
21 | -class Diff{ |
|
21 | +class Diff { |
|
22 | 22 | |
23 | 23 | // define the constants |
24 | 24 | const UNMODIFIED = 0; |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * lines; this optional parameter defaults to false |
39 | 39 | */ |
40 | 40 | public static function compare( |
41 | - $string1, $string2, $compareCharacters = false){ |
|
41 | + $string1, $string2, $compareCharacters = false) { |
|
42 | 42 | |
43 | 43 | // initialise the sequences and comparison start and end positions |
44 | 44 | $start = 0; |
45 | - if ($compareCharacters){ |
|
45 | + if ($compareCharacters) { |
|
46 | 46 | $sequence1 = $string1; |
47 | 47 | $sequence2 = $string2; |
48 | 48 | $end1 = strlen($string1) - 1; |
49 | 49 | $end2 = strlen($string2) - 1; |
50 | - }else{ |
|
50 | + } else { |
|
51 | 51 | $sequence1 = preg_split('/\R/', $string1); |
52 | 52 | $sequence2 = preg_split('/\R/', $string2); |
53 | 53 | $end1 = count($sequence1) - 1; |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | |
57 | 57 | // skip any common prefix |
58 | 58 | while ($start <= $end1 && $start <= $end2 |
59 | - && $sequence1[$start] == $sequence2[$start]){ |
|
60 | - $start ++; |
|
59 | + && $sequence1[$start] == $sequence2[$start]) { |
|
60 | + $start++; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // skip any common suffix |
64 | 64 | while ($end1 >= $start && $end2 >= $start |
65 | - && $sequence1[$end1] == $sequence2[$end2]){ |
|
66 | - $end1 --; |
|
67 | - $end2 --; |
|
65 | + && $sequence1[$end1] == $sequence2[$end2]) { |
|
66 | + $end1--; |
|
67 | + $end2--; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // compute the table of longest common subsequence lengths |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | |
77 | 77 | // generate the full diff |
78 | 78 | $diff = array(); |
79 | - for ($index = 0; $index < $start; $index ++){ |
|
79 | + for ($index = 0; $index < $start; $index++) { |
|
80 | 80 | $diff[] = array($sequence1[$index], self::UNMODIFIED); |
81 | 81 | } |
82 | 82 | while (count($partialDiff) > 0) $diff[] = array_pop($partialDiff); |
83 | 83 | for ($index = $end1 + 1; |
84 | 84 | $index < ($compareCharacters ? strlen($sequence1) : count($sequence1)); |
85 | - $index ++){ |
|
85 | + $index++) { |
|
86 | 86 | $diff[] = array($sequence1[$index], self::UNMODIFIED); |
87 | 87 | } |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * lines; this optional parameter defaults to false |
100 | 100 | */ |
101 | 101 | public static function compareFiles( |
102 | - $file1, $file2, $compareCharacters = false){ |
|
102 | + $file1, $file2, $compareCharacters = false) { |
|
103 | 103 | |
104 | 104 | // return the diff of the files |
105 | 105 | return self::compare( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * $end2 - the ending index for the second sequence |
120 | 120 | */ |
121 | 121 | private static function computeTable( |
122 | - $sequence1, $sequence2, $start, $end1, $end2){ |
|
122 | + $sequence1, $sequence2, $start, $end1, $end2) { |
|
123 | 123 | |
124 | 124 | // determine the lengths to be compared |
125 | 125 | $length1 = $end1 - $start + 1; |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | $table = array(array_fill(0, $length2 + 1, 0)); |
130 | 130 | |
131 | 131 | // loop over the rows |
132 | - for ($index1 = 1; $index1 <= $length1; $index1 ++){ |
|
132 | + for ($index1 = 1; $index1 <= $length1; $index1++) { |
|
133 | 133 | |
134 | 134 | // create the new row |
135 | 135 | $table[$index1] = array(0); |
136 | 136 | |
137 | 137 | // loop over the columns |
138 | - for ($index2 = 1; $index2 <= $length2; $index2 ++){ |
|
138 | + for ($index2 = 1; $index2 <= $length2; $index2++) { |
|
139 | 139 | |
140 | 140 | // store the longest common subsequence length |
141 | 141 | if ($sequence1[$index1 + $start - 1] |
142 | - == $sequence2[$index2 + $start - 1]){ |
|
142 | + == $sequence2[$index2 + $start - 1]) { |
|
143 | 143 | $table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1; |
144 | - }else{ |
|
144 | + } else { |
|
145 | 145 | $table[$index1][$index2] = |
146 | 146 | max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]); |
147 | 147 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * $start - the starting index |
164 | 164 | */ |
165 | 165 | private static function generatePartialDiff( |
166 | - $table, $sequence1, $sequence2, $start){ |
|
166 | + $table, $sequence1, $sequence2, $start) { |
|
167 | 167 | |
168 | 168 | // initialise the diff |
169 | 169 | $diff = array(); |
@@ -173,30 +173,30 @@ discard block |
||
173 | 173 | $index2 = count($table[0]) - 1; |
174 | 174 | |
175 | 175 | // loop until there are no items remaining in either sequence |
176 | - while ($index1 > 0 || $index2 > 0){ |
|
176 | + while ($index1 > 0 || $index2 > 0) { |
|
177 | 177 | |
178 | 178 | // check what has happened to the items at these indices |
179 | 179 | if ($index1 > 0 && $index2 > 0 |
180 | 180 | && $sequence1[$index1 + $start - 1] |
181 | - == $sequence2[$index2 + $start - 1]){ |
|
181 | + == $sequence2[$index2 + $start - 1]) { |
|
182 | 182 | |
183 | 183 | // update the diff and the indices |
184 | 184 | $diff[] = array($sequence1[$index1 + $start - 1], self::UNMODIFIED); |
185 | - $index1 --; |
|
186 | - $index2 --; |
|
185 | + $index1--; |
|
186 | + $index2--; |
|
187 | 187 | |
188 | 188 | }elseif ($index2 > 0 |
189 | - && $table[$index1][$index2] == $table[$index1][$index2 - 1]){ |
|
189 | + && $table[$index1][$index2] == $table[$index1][$index2 - 1]) { |
|
190 | 190 | |
191 | 191 | // update the diff and the indices |
192 | 192 | $diff[] = array($sequence2[$index2 + $start - 1], self::INSERTED); |
193 | - $index2 --; |
|
193 | + $index2--; |
|
194 | 194 | |
195 | - }else{ |
|
195 | + } else { |
|
196 | 196 | |
197 | 197 | // update the diff and the indices |
198 | 198 | $diff[] = array($sequence1[$index1 + $start - 1], self::DELETED); |
199 | - $index1 --; |
|
199 | + $index1--; |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | |
@@ -215,19 +215,19 @@ discard block |
||
215 | 215 | * $separator - the separator between lines; this optional parameter defaults |
216 | 216 | * to "\n" |
217 | 217 | */ |
218 | - public static function toString($diff, $separator = "\n"){ |
|
218 | + public static function toString($diff, $separator = "\n") { |
|
219 | 219 | |
220 | 220 | // initialise the string |
221 | 221 | $string = ''; |
222 | 222 | |
223 | 223 | // loop over the lines in the diff |
224 | - foreach ($diff as $line){ |
|
224 | + foreach ($diff as $line) { |
|
225 | 225 | |
226 | 226 | // extend the string with the line |
227 | - switch ($line[1]){ |
|
228 | - case self::UNMODIFIED : $string .= ' ' . $line[0];break; |
|
229 | - case self::DELETED : $string .= '- ' . $line[0];break; |
|
230 | - case self::INSERTED : $string .= '+ ' . $line[0];break; |
|
227 | + switch ($line[1]) { |
|
228 | + case self::UNMODIFIED : $string .= ' ' . $line[0]; break; |
|
229 | + case self::DELETED : $string .= '- ' . $line[0]; break; |
|
230 | + case self::INSERTED : $string .= '+ ' . $line[0]; break; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // extend the string with the separator |
@@ -248,19 +248,19 @@ discard block |
||
248 | 248 | * $separator - the separator between lines; this optional parameter defaults |
249 | 249 | * to '<br>' |
250 | 250 | */ |
251 | - public static function toHTML($diff, $separator = '<br>'){ |
|
251 | + public static function toHTML($diff, $separator = '<br>') { |
|
252 | 252 | |
253 | 253 | // initialise the HTML |
254 | 254 | $html = ''; |
255 | 255 | |
256 | 256 | // loop over the lines in the diff |
257 | - foreach ($diff as $line){ |
|
257 | + foreach ($diff as $line) { |
|
258 | 258 | |
259 | 259 | // extend the HTML with the line |
260 | - switch ($line[1]){ |
|
260 | + switch ($line[1]) { |
|
261 | 261 | case self::UNMODIFIED : $element = 'span'; break; |
262 | - case self::DELETED : $element = 'del'; break; |
|
263 | - case self::INSERTED : $element = 'ins'; break; |
|
262 | + case self::DELETED : $element = 'del'; break; |
|
263 | + case self::INSERTED : $element = 'ins'; break; |
|
264 | 264 | } |
265 | 265 | $html .= |
266 | 266 | '<' . $element . '>' |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | * $separator - the separator between lines; this optional parameter |
286 | 286 | * defaults to '<br>' |
287 | 287 | */ |
288 | - public static function toTable($diff, $indentation = '', $separator = '<br>'){ |
|
288 | + public static function toTable($diff, $indentation = '', $separator = '<br>') { |
|
289 | 289 | |
290 | 290 | // initialise the HTML |
291 | 291 | $html = $indentation . "<table class=\"diff\">\n"; |
292 | 292 | |
293 | 293 | // loop over the lines in the diff |
294 | 294 | $index = 0; |
295 | - while ($index < count($diff)){ |
|
295 | + while ($index < count($diff)) { |
|
296 | 296 | |
297 | 297 | // determine the line type |
298 | - switch ($diff[$index][1]){ |
|
298 | + switch ($diff[$index][1]) { |
|
299 | 299 | |
300 | 300 | // display the content on the left and right |
301 | 301 | case self::UNMODIFIED: |
@@ -365,19 +365,19 @@ discard block |
||
365 | 365 | * $type - the type of line |
366 | 366 | */ |
367 | 367 | private static function getCellContent( |
368 | - $diff, $indentation, $separator, &$index, $type){ |
|
368 | + $diff, $indentation, $separator, &$index, $type) { |
|
369 | 369 | |
370 | 370 | // initialise the HTML |
371 | 371 | $html = ''; |
372 | 372 | |
373 | 373 | // loop over the matching lines, adding them to the HTML |
374 | - while ($index < count($diff) && $diff[$index][1] == $type){ |
|
374 | + while ($index < count($diff) && $diff[$index][1] == $type) { |
|
375 | 375 | $html .= |
376 | 376 | '<span>' |
377 | 377 | . htmlspecialchars($diff[$index][0]) |
378 | 378 | . '</span>' |
379 | 379 | . $separator; |
380 | - $index ++; |
|
380 | + $index++; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // return the HTML |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | function __construct(Config $config, string $language = '') |
37 | 37 | { |
38 | 38 | $this->config = $config; |
39 | - $this->language = empty($language) ? $this->config->get('addon.default_language') : $language; |
|
39 | + $this->language = empty($language) ? $this->config->get('addon.default_language') : $language; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | throw new \InvalidArgumentException('Nor language param and addon default_language are specified'); |
187 | 187 | } |
188 | 188 | |
189 | - $language_information = self::$codes[$this->language]; |
|
189 | + $language_information = self::$codes[$this->language]; |
|
190 | 190 | $po_heading = str_replace( |
191 | 191 | [ |
192 | 192 | '${code}', |