Passed
Push — master ( 8b5ce5...b7fcc1 )
by Sebastian
12:08
created
src/Localization/Editor/Template/PageScaffold.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 <?php $this->renderAppLocales(); ?>
73 73
                 <?php
74 74
                 $backURL = $this->editor->getBackURL();
75
-                if(!empty($backURL))
75
+                if (!empty($backURL))
76 76
                 {
77 77
                     ?>
78 78
                     <a href="<?php echo $backURL ?>" class="btn btn-light btn-sm">
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             <?php
110 110
             $warnings = $this->editor->getScannerWarnings();
111 111
 
112
-            foreach($warnings as $warning)
112
+            foreach ($warnings as $warning)
113 113
             {
114 114
                 ?>
115 115
                 <dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt>
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         $strings = $this->editor->getFilteredStrings();
128 128
 
129
-        if(empty($strings))
129
+        if (empty($strings))
130 130
         {
131 131
             ?>
132 132
             <div class="alert alert-info">
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             <div class="form-hiddens">
149 149
                 <?php
150 150
                 $params = $this-> editor->getRequestParams();
151
-                foreach($params as $name => $value) {
151
+                foreach ($params as $name => $value) {
152 152
                     ?>
153 153
                     <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
154 154
                     <?php
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                 </thead>
167 167
                 <tbody>
168 168
                 <?php
169
-                foreach($keep as $string)
169
+                foreach ($keep as $string)
170 170
                 {
171 171
                     $this->renderTextEditorEntry($string);
172 172
                 }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                 </tbody>
175 175
             </table>
176 176
             <?php
177
-            if($pager->hasPages())
177
+            if ($pager->hasPages())
178 178
             {
179 179
                 $prevUrl = $this->editor->getPaginationURL($pager->getPreviousPage());
180 180
                 $nextUrl = $this->editor->getPaginationURL($pager->getNextPage());
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
                         </li>
190 190
                         <?php
191 191
                         $numbers = $pager->getPageNumbers();
192
-                        foreach($numbers as $number)
192
+                        foreach ($numbers as $number)
193 193
                         {
194 194
                             $url = $this->editor->getPaginationURL($number);
195 195
 
196 196
                             ?>
197
-                            <li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>">
197
+                            <li class="page-item <?php if ($pager->isCurrentPage($number)) { echo 'active'; } ?>">
198 198
                                 <a class="page-link" href="<?php echo $url ?>">
199 199
                                     <?php echo $number ?>
200 200
                                 </a>
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         $hash = $string->getHash();
230 230
         $text = $string->getText();
231 231
 
232
-        if($text===null)
232
+        if ($text === null)
233 233
         {
234 234
             throw new EditorException(
235 235
                 'String hash has no text',
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
         }
240 240
 
241 241
         $previewText = $string->getTranslatedText();
242
-        if(empty($previewText)) {
242
+        if (empty($previewText)) {
243 243
             $previewText = $text->getText();
244 244
         }
245 245
 
246
-        $shortText =  $this->renderText($previewText, 50);
246
+        $shortText = $this->renderText($previewText, 50);
247 247
 
248 248
         $files = $string->getFiles();
249 249
         $labelID = JSHelper::nextElementID();
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                 </p>
265 265
                 <?php
266 266
                 $explanation = $text->getExplanation();
267
-                if(!empty($explanation))
267
+                if (!empty($explanation))
268 268
                 {
269 269
                     ?>
270 270
                     <p>
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                         <?php
288 288
                         $totalFiles = count($files);
289 289
 
290
-                        if($totalFiles == 1)
290
+                        if ($totalFiles == 1)
291 291
                         {
292 292
                             pt('Found in a single file:');
293 293
                         }
@@ -302,16 +302,16 @@  discard block
 block discarded – undo
302 302
                             <?php
303 303
                             $locations = $string->getStrings();
304 304
 
305
-                            foreach($locations as $location)
305
+                            foreach ($locations as $location)
306 306
                             {
307 307
                                 $file = $location->getSourceFile();
308 308
                                 $line = $location->getLine();
309 309
 
310 310
                                 $ext = FileHelper::getExtension($file);
311 311
 
312
-                                if($ext == 'php') {
312
+                                if ($ext == 'php') {
313 313
                                     $icon = 'fab fa-php';
314
-                                } else if($ext == 'js') {
314
+                                } else if ($ext == 'js') {
315 315
                                     $icon = 'fab fa-js-square';
316 316
                                 } else {
317 317
                                     $icon = 'fas fa-file-code';
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
         <?php
334 334
     }
335 335
 
336
-    protected function renderText(string $text, int $cutAt=0) : string
336
+    protected function renderText(string $text, int $cutAt = 0) : string
337 337
     {
338
-        if(empty($text)) {
338
+        if (empty($text)) {
339 339
             return '';
340 340
         }
341 341
 
342
-        if($cutAt > 0) {
342
+        if ($cutAt > 0) {
343 343
             $text = ConvertHelper::text_cut($text, $cutAt);
344 344
         }
345 345
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
         $vars = $this->editor->detectVariables($text);
349 349
 
350
-        foreach($vars as $var) {
350
+        foreach ($vars as $var) {
351 351
             $text = str_replace($var, '<span class="placeholder">'.$var.'</span>', $text);
352 352
         }
353 353
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             <?php
533 533
             pt(
534 534
                 'You are translating to %1$s',
535
-                '<span class="badge badge-info">' . $activeLocale->getLabel() . '</span>'
535
+                '<span class="badge badge-info">'.$activeLocale->getLabel().'</span>'
536 536
             );
537 537
             ?><br>
538 538
 
@@ -572,10 +572,10 @@  discard block
 block discarded – undo
572 572
 
573 573
         // add a counter of the additional files if the total
574 574
         // is higher than the maximum to show
575
-        if($total > $max)
575
+        if ($total > $max)
576 576
         {
577 577
             $length = $max;
578
-            if($length > $keepTotal) {
578
+            if ($length > $keepTotal) {
579 579
                 $length = $keepTotal;
580 580
             }
581 581
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
     protected function renderStatus(Localization_Scanner_StringHash $hash) : string
590 590
     {
591
-        if($hash->isTranslated()) {
591
+        if ($hash->isTranslated()) {
592 592
             return '<i class="fa fa-check text-success"></i>';
593 593
         }
594 594
 
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
     {
600 600
         $types = array();
601 601
 
602
-        if($hash->hasLanguageType('PHP')) {
602
+        if ($hash->hasLanguageType('PHP')) {
603 603
             $types[] = t('Server');
604 604
         }
605 605
 
606
-        if($hash->hasLanguageType('Javascript')) {
606
+        if ($hash->hasLanguageType('Javascript')) {
607 607
             $types[] = t('Client');
608 608
         }
609 609
 
Please login to merge, or discard this patch.
src/Localization/Source/Scanner.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         $texts = $language->getTexts();
61 61
 
62
-        foreach($texts as $text)
62
+        foreach ($texts as $text)
63 63
         {
64 64
             $this->collection->addFromFile(
65 65
                 $this->source->getID(),
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         $warnings = $language->getWarnings();
73 73
 
74
-        foreach($warnings as $warning)
74
+        foreach ($warnings as $warning)
75 75
         {
76 76
             $this->collection->addWarning($warning);
77 77
         }
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 
94 94
         $hashes = $this->getHashes();
95 95
 
96
-        foreach($hashes as $hash)
96
+        foreach ($hashes as $hash)
97 97
         {
98 98
             $text = $translator->getHashTranslation($hash->getHash());
99 99
 
100
-            if(empty($text))
100
+            if (empty($text))
101 101
             {
102 102
                 $amount++;
103 103
             }
Please login to merge, or discard this patch.
src/Localization/Editor.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     public function __construct()
103 103
     {
104 104
         $path = realpath(__DIR__.'/../');
105
-        if($path === false)
105
+        if ($path === false)
106 106
         {
107 107
             throw new Localization_Exception(
108 108
                 'Local path not found',
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
     
151 151
     protected function initSession() : void
152 152
     {
153
-        if(session_status() != PHP_SESSION_ACTIVE) {
153
+        if (session_status() != PHP_SESSION_ACTIVE) {
154 154
             session_start();
155 155
         }
156 156
         
157
-        if(!isset($_SESSION['localization_messages'])) {
157
+        if (!isset($_SESSION['localization_messages'])) {
158 158
             $_SESSION['localization_messages'] = array();
159 159
         }
160 160
     }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $this->sources = Localization::getSources();
173 173
         
174
-        if(empty($this->sources)) 
174
+        if (empty($this->sources)) 
175 175
         {
176 176
             throw new Localization_Exception(
177 177
                 'Cannot start editor: no sources defined.',
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         }
182 182
         
183 183
         $activeID = $this->request->registerParam($this->getVarName('source'))->setEnum(Localization::getSourceIDs())->get();
184
-        if(empty($activeID)) {
184
+        if (empty($activeID)) {
185 185
             $activeID = $this->getDefaultSourceID();
186 186
         }
187 187
         
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     protected function getDefaultSourceID() : string
192 192
     {
193 193
         $default = $this->getOption('default-source');
194
-        if(!empty($default) && Localization::sourceAliasExists($default)) {
194
+        if (!empty($default) && Localization::sourceAliasExists($default)) {
195 195
             return Localization::getSourceByAlias($default)->getID();
196 196
         }
197 197
         
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
         $names = array();
204 204
         
205 205
         $locales = Localization::getAppLocales();
206
-        foreach($locales as $locale) {
207
-            if(!$locale->isNative()) {
206
+        foreach ($locales as $locale) {
207
+            if (!$locale->isNative()) {
208 208
                 $this->appLocales[] = $locale;
209 209
                 $names[] = $locale->getName();
210 210
             }
211 211
         }
212 212
         
213 213
         // use the default locale if no other is available.
214
-        if(empty($names)) {
214
+        if (empty($names)) {
215 215
             $this->activeAppLocale = Localization::getAppLocale();
216 216
             return;
217 217
         }
218 218
        
219 219
         $activeID = $this->request->registerParam($this->getVarName('locale'))->setEnum($names)->get();
220
-        if(empty($activeID)) {
220
+        if (empty($activeID)) {
221 221
             $activeID = $this->appLocales[0]->getName();
222 222
         }
223 223
         
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
         
269 269
         $this->filters = new Localization_Editor_Filters($this);
270 270
         
271
-        if($this->request->getBool($this->getVarName(self::VARIABLE_SCAN)))
271
+        if ($this->request->getBool($this->getVarName(self::VARIABLE_SCAN)))
272 272
         {
273 273
             $this->executeScan();
274 274
         } 
275
-        else if($this->request->getBool($this->getSaveVariableName()))
275
+        else if ($this->request->getBool($this->getSaveVariableName()))
276 276
         {
277 277
             $this->executeSave();
278 278
         }
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
         
327 327
         $result = array();
328 328
         
329
-        foreach($strings as $string)
329
+        foreach ($strings as $string)
330 330
         {
331
-            if($this->filters->isStringMatch($string)) {
331
+            if ($this->filters->isStringMatch($string)) {
332 332
                 $result[] = $string;
333 333
             }
334 334
         }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         return $this->activeAppLocale;
366 366
     }
367 367
 
368
-    public function getPaginationURL(int $page, array $params=array()) : string
368
+    public function getPaginationURL(int $page, array $params = array()) : string
369 369
     {
370 370
         $params[$this->getVarName('page')] = $page;
371 371
         
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         $result = array();
378 378
         preg_match_all('/%[0-9]+d|%s|%[0-9]+\$s/i', $string, $result, PREG_PATTERN_ORDER);
379 379
 
380
-        if(isset($result[0]) && !empty($result[0])) {
380
+        if (isset($result[0]) && !empty($result[0])) {
381 381
             return $result[0];
382 382
         }
383 383
         
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
         echo $this->render();
390 390
     }
391 391
     
392
-    public function getSourceURL(Localization_Source $source, array $params=array()) : string
392
+    public function getSourceURL(Localization_Source $source, array $params = array()) : string
393 393
     {
394 394
         $params[$this->getVarName('source')] = $source->getID();
395 395
         
396 396
         return $this->getURL($params);
397 397
     }
398 398
     
399
-    public function getLocaleURL(Localization_Locale $locale, array $params=array()) : string
399
+    public function getLocaleURL(Localization_Locale $locale, array $params = array()) : string
400 400
     {
401 401
         $params[$this->getVarName('locale')] = $locale->getName();
402 402
         
@@ -413,12 +413,12 @@  discard block
 block discarded – undo
413 413
         return $this->getSourceURL($this->activeSource, array($this->getVarName(self::VARIABLE_WARNINGS) => 'yes'));
414 414
     }
415 415
     
416
-    public function getURL(array $params=array()) : string
416
+    public function getURL(array $params = array()) : string
417 417
     {
418 418
         $persist = $this->getRequestParams();
419 419
         
420
-        foreach($persist as $name => $value) {
421
-            if(!isset($params[$name])) {
420
+        foreach ($persist as $name => $value) {
421
+            if (!isset($params[$name])) {
422 422
                 $params[$name] = $value;
423 423
             }
424 424
         }
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
         $translator = Localization::getTranslator($this->activeAppLocale);
456 456
         
457 457
         $strings = $data[$this->getVarName(self::VARIABLE_STRINGS)];
458
-        foreach($strings as $hash => $text) 
458
+        foreach ($strings as $hash => $text) 
459 459
         {
460 460
             $text = trim($text);
461 461
             
462
-            if(empty($text)) {
462
+            if (empty($text)) {
463 463
                 continue;
464 464
             } 
465 465
             
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         $this->redirect($this->getURL());
480 480
     }
481 481
     
482
-    protected function addMessage(string $message, string $type=self::MESSAGE_INFO) : void
482
+    protected function addMessage(string $message, string $type = self::MESSAGE_INFO) : void
483 483
     {
484 484
         $_SESSION['localization_messages'][] = array(
485 485
             'text' => $message,
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
     public function getAppName() : string
517 517
     {
518 518
         $name = $this->getOption('appname');
519
-        if(!empty($name)) {
519
+        if (!empty($name)) {
520 520
             return $name;
521 521
         }
522 522
         
Please login to merge, or discard this patch.
src/Localization/Currency/USD.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
         return true;
40 40
     }
41 41
 
42
-    public function getStructuralTemplate(?CountryInterface $country=null) : string
42
+    public function getStructuralTemplate(?CountryInterface $country = null) : string
43 43
     {
44 44
         return '-{symbol}{amount}';
45 45
     }
Please login to merge, or discard this patch.
src/Localization/Currency/CHF.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         return t('Swiss Francs');
42 42
     }
43 43
 
44
-    public function getStructuralTemplate(?CountryInterface $country=null): string
44
+    public function getStructuralTemplate(?CountryInterface $country = null): string
45 45
     {
46 46
         return '-{amount} {symbol}';
47 47
     }
Please login to merge, or discard this patch.
src/Localization/Currency/GBP.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         return false;
42 42
     }
43 43
 
44
-    public function getStructuralTemplate(?CountryInterface $country=null): string
44
+    public function getStructuralTemplate(?CountryInterface $country = null): string
45 45
     {
46 46
         return '-{symbol}{amount}';
47 47
     }
Please login to merge, or discard this patch.
src/Localization/Currency/PLN.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         return false;
42 42
     }
43 43
 
44
-    public function getStructuralTemplate(?CountryInterface $country=null): string
44
+    public function getStructuralTemplate(?CountryInterface $country = null): string
45 45
     {
46 46
         return '-{amount} {symbol}';
47 47
     }
Please login to merge, or discard this patch.
src/Localization/Currency/RON.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         return false;
42 42
     }
43 43
 
44
-    public function getStructuralTemplate(?CountryInterface $country=null): string
44
+    public function getStructuralTemplate(?CountryInterface $country = null): string
45 45
     {
46 46
         return '-{amount} {symbol}';
47 47
     }
Please login to merge, or discard this patch.
src/Localization/Currency/MXN.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         return true;
42 42
     }
43 43
 
44
-    public function getStructuralTemplate(?CountryInterface $country=null): string
44
+    public function getStructuralTemplate(?CountryInterface $country = null): string
45 45
     {
46 46
         return '{symbol} -{amount}';
47 47
     }
Please login to merge, or discard this patch.