Test Setup Failed
Branch master (316542)
by Sebastian
04:46
created
src/Localization/Parser/Token/PHP.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@
 block discarded – undo
9 9
     protected function parseDefinition() : void
10 10
     {
11 11
         // some entries are strings, like parenthesises, semicolons and the like.
12
-        if(is_string($this->definition))
12
+        if (is_string($this->definition))
13 13
         {
14 14
             $this->token = $this->definition;
15 15
             $this->value = null;
16 16
             
17
-            if(isset($this->parentToken)) {
17
+            if (isset($this->parentToken)) {
18 18
                 $this->line = $this->parentToken->getLine();
19 19
             }
20 20
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
             if(isset($this->parentToken)) {
18 18
                 $this->line = $this->parentToken->getLine();
19 19
             }
20
-        }
21
-        else
20
+        } else
22 21
         {
23 22
             $this->token = token_name($this->definition[0]);
24 23
             $this->value = $this->definition[1];
Please login to merge, or discard this patch.
src/Localization/Parser.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
     
28 28
     const ERROR_UNSUPPORTED_FILE_EXTENSION = 40602;
29 29
     
30
-   /**
31
-    * @var Localization_Scanner
32
-    */
30
+    /**
31
+     * @var Localization_Scanner
32
+     */
33 33
     protected $scanner;
34 34
     
35
-   /**
36
-    * @var Localization_Scanner_StringsCollection
37
-    */
35
+    /**
36
+     * @var Localization_Scanner_StringsCollection
37
+     */
38 38
     protected $collection;
39 39
     
40 40
     protected $languageMappings = array(
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
         $this->collection = $scanner->getCollection();
49 49
     }
50 50
     
51
-   /**
52
-    * Parses a source file. Must have a valid supported file extension.
53
-    * 
54
-    * @param string $path
55
-    * @return Localization_Parser_Language
56
-    * @throws Localization_Exception
57
-    * 
58
-    * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION
59
-    */
51
+    /**
52
+     * Parses a source file. Must have a valid supported file extension.
53
+     * 
54
+     * @param string $path
55
+     * @return Localization_Parser_Language
56
+     * @throws Localization_Exception
57
+     * 
58
+     * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION
59
+     */
60 60
     public function parseFile(string $path) : Localization_Parser_Language
61 61
     {
62 62
         $this->requireValidFile($path);
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
         return $language;
71 71
     }
72 72
     
73
-   /**
74
-    * Parses the string for the specified language.
75
-    * 
76
-    * @param string $languageID
77
-    * @param string $code
78
-    * @return Localization_Parser_Language
79
-    * @throws Localization_Exception
80
-    * 
81
-    * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID
82
-    */
73
+    /**
74
+     * Parses the string for the specified language.
75
+     * 
76
+     * @param string $languageID
77
+     * @param string $code
78
+     * @return Localization_Parser_Language
79
+     * @throws Localization_Exception
80
+     * 
81
+     * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID
82
+     */
83 83
     public function parseString(string $languageID, string $code) : Localization_Parser_Language
84 84
     {
85 85
         $this->requireValidLanguageID($languageID);
@@ -128,29 +128,29 @@  discard block
 block discarded – undo
128 128
         );
129 129
     }
130 130
     
131
-   /**
132
-    * Retrieves a list of all language IDs that are supported.
133
-    * @return string[] IDs list like "PHP", "Javascript"
134
-    */
131
+    /**
132
+     * Retrieves a list of all language IDs that are supported.
133
+     * @return string[] IDs list like "PHP", "Javascript"
134
+     */
135 135
     public function getLanguageIDs() : array
136 136
     {
137 137
         return array_values($this->languageMappings);
138 138
     }
139 139
     
140
-   /**
141
-    * @var Localization_Parser_Language[]
142
-    */
140
+    /**
141
+     * @var Localization_Parser_Language[]
142
+     */
143 143
     protected $languageParsers = array();
144 144
     
145
-   /**
146
-    * Creates a parser for the specified language, e.g. "PHP".
147
-    * NOTE: Existing parser instances are re-used.
148
-    * 
149
-    * @param string $languageID
150
-    * @return Localization_Parser_Language
151
-    * 
152
-    * @see  Localization_Parser::ERROR_INVALID_LANGUAGE_ID
153
-    */
145
+    /**
146
+     * Creates a parser for the specified language, e.g. "PHP".
147
+     * NOTE: Existing parser instances are re-used.
148
+     * 
149
+     * @param string $languageID
150
+     * @return Localization_Parser_Language
151
+     * 
152
+     * @see  Localization_Parser::ERROR_INVALID_LANGUAGE_ID
153
+     */
154 154
     public function createLanguage(string $languageID)
155 155
     {
156 156
         $this->requireValidLanguageID($languageID);
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         return $this->languageParsers[$languageID];
166 166
     }
167 167
     
168
-   /**
169
-    * Whether the specified file extension is supported.
170
-    * 
171
-    * @param string $ext
172
-    * @return bool
173
-    */
168
+    /**
169
+     * Whether the specified file extension is supported.
170
+     * 
171
+     * @param string $ext
172
+     * @return bool
173
+     */
174 174
     public function isExtensionSupported(string $ext) : bool
175 175
     {
176 176
         $ext = strtolower($ext);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         $ext = \AppUtils\FileHelper::getExtension($path);
97 97
         
98
-        if($this->isExtensionSupported($ext)) {
98
+        if ($this->isExtensionSupported($ext)) {
99 99
             return;
100 100
         }
101 101
         
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $values = $this->getLanguageIDs();
115 115
         
116
-        if(in_array($languageID, $values)) {
116
+        if (in_array($languageID, $values)) {
117 117
             return;
118 118
         }
119 119
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $this->requireValidLanguageID($languageID);
157 157
         
158
-        if(!isset($this->languageParsers[$languageID])) 
158
+        if (!isset($this->languageParsers[$languageID])) 
159 159
         {
160 160
             $class = '\AppLocalize\Localization_Parser_Language_'.$languageID;
161 161
         
Please login to merge, or discard this patch.
src/Localization/Event/LocaleChanged.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Localization_Event_LocaleChanged extends Localization_Event
22 22
 {
23
-   /**
24
-    * The locale that was used before the change, if any.
25
-    * @return Localization_Locale|NULL
26
-    */
23
+    /**
24
+     * The locale that was used before the change, if any.
25
+     * @return Localization_Locale|NULL
26
+     */
27 27
     public function getPrevious() : ?Localization_Locale
28 28
     {
29 29
         $arg = $this->getArgument(1);
@@ -34,38 +34,38 @@  discard block
 block discarded – undo
34 34
         return null;
35 35
     }
36 36
     
37
-   /**
38
-    * The locale that is used now after the change.
39
-    * @return Localization_Locale
40
-    */
37
+    /**
38
+     * The locale that is used now after the change.
39
+     * @return Localization_Locale
40
+     */
41 41
     public function getCurrent() : Localization_Locale
42 42
     {
43 43
         $arg = $this->getArgument(2);
44 44
         return $arg['locale'];
45 45
     }
46 46
     
47
-   /**
48
-    * The namespace in which the locale change occurred.
49
-    * @return string
50
-    */
47
+    /**
48
+     * The namespace in which the locale change occurred.
49
+     * @return string
50
+     */
51 51
     public function getNamespace() : string
52 52
     {
53 53
         return $this->getArgument(0);
54 54
     }
55 55
 
56
-   /**
57
-    * Whether the change occurred for an application locale.
58
-    * @return bool
59
-    */
56
+    /**
57
+     * Whether the change occurred for an application locale.
58
+     * @return bool
59
+     */
60 60
     public function isAppLocale() : bool
61 61
     {
62 62
         return $this->getNamespace() === Localization::NAMESPACE_APPLICATION;
63 63
     }
64 64
     
65
-   /**
66
-    * Whether the change occurred for a content locale.
67
-    * @return bool
68
-    */
65
+    /**
66
+     * Whether the change occurred for a content locale.
67
+     * @return bool
68
+     */
69 69
     public function isContentLocale() : bool
70 70
     {
71 71
         return $this->getNamespace() === Localization::NAMESPACE_CONTENT;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     public function getPrevious() : ?Localization_Locale
28 28
     {
29 29
         $arg = $this->getArgument(1);
30
-        if(is_array($arg)) {
30
+        if (is_array($arg)) {
31 31
             return $arg['locale'];
32 32
         }
33 33
         
Please login to merge, or discard this patch.
src/Localization/Editor.php 3 patches
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -22,44 +22,44 @@  discard block
 block discarded – undo
22 22
     
23 23
     const ERROR_NO_SOURCES_AVAILABLE = 40001;
24 24
     
25
-   /**
26
-    * @var string
27
-    */
25
+    /**
26
+     * @var string
27
+     */
28 28
     protected $installPath;
29 29
     
30
-   /**
31
-    * @var Localization_Source[]
32
-    */
30
+    /**
31
+     * @var Localization_Source[]
32
+     */
33 33
     protected $sources;
34 34
     
35
-   /**
36
-    * @var \AppUtils\Request
37
-    */
35
+    /**
36
+     * @var \AppUtils\Request
37
+     */
38 38
     protected $request;
39 39
     
40
-   /**
41
-    * @var Localization_Source
42
-    */
40
+    /**
41
+     * @var Localization_Source
42
+     */
43 43
     protected $activeSource;
44 44
     
45
-   /**
46
-    * @var Localization_Scanner
47
-    */
45
+    /**
46
+     * @var Localization_Scanner
47
+     */
48 48
     protected $scanner;
49 49
     
50
-   /**
51
-    * @var Localization_Locale[]
52
-    */
50
+    /**
51
+     * @var Localization_Locale[]
52
+     */
53 53
     protected $appLocales = array();
54 54
     
55
-   /**
56
-    * @var Localization_Locale
57
-    */
55
+    /**
56
+     * @var Localization_Locale
57
+     */
58 58
     protected $activeAppLocale;
59 59
     
60
-   /**
61
-    * @var Localization_Editor_Filters
62
-    */
60
+    /**
61
+     * @var Localization_Editor_Filters
62
+     */
63 63
     protected $filters;
64 64
 
65 65
     protected $requestParams = array();
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
         return $this->request;
81 81
     }
82 82
     
83
-   /**
84
-    * Adds a request parameter that will be persisted in all URLs
85
-    * within the editor. This can be used when integrating the
86
-    * editor in an existing page that needs specific request params.
87
-    * 
88
-    * @param string $name
89
-    * @param string $value
90
-    * @return Localization_Editor
91
-    */
83
+    /**
84
+     * Adds a request parameter that will be persisted in all URLs
85
+     * within the editor. This can be used when integrating the
86
+     * editor in an existing page that needs specific request params.
87
+     * 
88
+     * @param string $name
89
+     * @param string $value
90
+     * @return Localization_Editor
91
+     */
92 92
     public function addRequestParam(string $name, string $value) : Localization_Editor
93 93
     {
94 94
         $this->requestParams[$name] = $value;
@@ -241,34 +241,34 @@  discard block
 block discarded – undo
241 241
                                 	</a>
242 242
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
243 243
                                     	<?php 
244
-                                    	    foreach($this->sources as $source)
245
-                                    	    {
246
-                                    	       ?>
244
+                                            foreach($this->sources as $source)
245
+                                            {
246
+                                                ?>
247 247
                                         			<a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>">
248 248
                                         				<?php 
249
-                                            				if($source->getID() === $this->activeSource->getID()) 
250
-                                            				{
251
-                                            				    ?>
249
+                                                            if($source->getID() === $this->activeSource->getID()) 
250
+                                                            {
251
+                                                                ?>
252 252
                                             				    	<b><?php echo $source->getLabel() ?></b>
253 253
                                         				    	<?php 
254
-                                            				}
255
-                                            				else
256
-                                            				{
257
-                                            				    echo $source->getLabel();
258
-                                            				}
259
-                                        				?>
254
+                                                            }
255
+                                                            else
256
+                                                            {
257
+                                                                echo $source->getLabel();
258
+                                                            }
259
+                                                        ?>
260 260
                                         				<?php
261
-                                        				    $untranslated = $source->countUntranslated($this->scanner);
262
-                                        				    if($untranslated > 0) {
263
-                                        				        ?>
261
+                                                            $untranslated = $source->countUntranslated($this->scanner);
262
+                                                            if($untranslated > 0) {
263
+                                                                ?>
264 264
                                         				        	(<span class="text-danger" title="<?php pt('%1$s texts have not been translated in this text source.', $untranslated) ?>"><?php echo $untranslated ?></span>)
265 265
                                 				            	<?php 
266
-                                        				    }
267
-                                    				    ?>
266
+                                                            }
267
+                                                        ?>
268 268
                                     				</a>
269 269
                                     			<?php 
270
-                                    	    }
271
-                                	    ?>
270
+                                            }
271
+                                        ?>
272 272
                                     </div>
273 273
                                 </li>
274 274
                                 <li class="nav-item dropdown">
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
                                 	</a>
278 278
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
279 279
                                     	<?php 
280
-                                    	    foreach($this->appLocales as $locale)
281
-                                    	    {
282
-                                    	       ?>
280
+                                            foreach($this->appLocales as $locale)
281
+                                            {
282
+                                                ?>
283 283
                                         			<a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>">
284 284
                                         				<?php echo $locale->getLabel() ?>
285 285
                                     				</a>
286 286
                                     			<?php 
287
-                                    	    }
288
-                                	    ?>
287
+                                            }
288
+                                        ?>
289 289
                                     </div>
290 290
                                 </li>
291 291
                                 <li class="nav-item">
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
                                     </a>
296 296
                     			</li>
297 297
                     			<?php 
298
-                        			if($this->scanner->hasWarnings()) {
299
-                        			    ?>
298
+                                    if($this->scanner->hasWarnings()) {
299
+                                        ?>
300 300
                         			    	<li class="nav-item">
301 301
                         			    		<a href="<?php echo $this->getWarningsURL() ?>">
302 302
                             			    		<span class="badge badge-warning" title="<?php pts('The last scan for translateable texts reported warnings.'); pts('Click for details.'); ?>" data-toggle="tooltip">
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
                         			    		</a>
307 307
                         			    	</li>
308 308
                         			    <?php 
309
-                        			}
310
-                    			?>
309
+                                    }
310
+                                ?>
311 311
                             </ul>
312 312
                         <?php 
313 313
                     }
@@ -323,36 +323,36 @@  discard block
 block discarded – undo
323 323
                         	</a>
324 324
                     	<?php 
325 325
                     }
326
-            	?>
326
+                ?>
327 327
     		</div>
328 328
 		</nav>
329 329
 		<main role="main" class="container">
330 330
 			<div>
331 331
     			<?php 
332
-    			    if(empty($this->appLocales))
333
-    			    {
334
-    			        ?>
332
+                    if(empty($this->appLocales))
333
+                    {
334
+                        ?>
335 335
     			        	<div class="alert alert-danger">
336 336
     			        		<i class="fa fa-exclamation-triangle"></i>
337 337
     			        		<b><?php pt('Nothing to translate:') ?></b>
338 338
     			        		<?php pt('No application locales were added to translate to.') ?>
339 339
     			        	</div>
340 340
     			        <?php 
341
-    			    }
342
-    			    else if($this->request->getBool($this->getVarName('warnings')))
343
-    			    {
344
-    			        echo $this->renderWarnings();
345
-    			    }
346
-    			    else
347
-    			    {
348
-    			        ?>
341
+                    }
342
+                    else if($this->request->getBool($this->getVarName('warnings')))
343
+                    {
344
+                        echo $this->renderWarnings();
345
+                    }
346
+                    else
347
+                    {
348
+                        ?>
349 349
             				<h1><?php echo $this->activeSource->getLabel() ?></h1>
350 350
             				<?php 
351
-                				if(!empty($_SESSION['localization_messages'])) 
352
-                				{
353
-                				    foreach($_SESSION['localization_messages'] as $def)
354
-                				    {
355
-                				        ?>
351
+                                if(!empty($_SESSION['localization_messages'])) 
352
+                                {
353
+                                    foreach($_SESSION['localization_messages'] as $def)
354
+                                    {
355
+                                        ?>
356 356
                 				        	<div class="alert alert-<?php echo $def['type'] ?>" role="alert">
357 357
                                         		<?php echo $def['text'] ?>
358 358
                                         		<button type="button" class="close" data-dismiss="alert" aria-label="<?php pt('Close') ?>" title="<?php pt('Dismiss this message.') ?>" data-toggle="tooltip">
@@ -360,28 +360,28 @@  discard block
 block discarded – undo
360 360
             									</button>
361 361
                                         	</div>
362 362
             				        	<?php 
363
-                				    }
363
+                                    }
364 364
                 				    
365
-                				    // reset the messages after having displayed them
366
-                				    $_SESSION['localization_messages'] = array();
367
-                				}
368
-            				?>
365
+                                    // reset the messages after having displayed them
366
+                                    $_SESSION['localization_messages'] = array();
367
+                                }
368
+                            ?>
369 369
             				<p>
370 370
             					<?php 
371
-            				        pt(
372
-                					    'You are translating to %1$s', 
373
-                					    '<span class="badge badge-info">'.
374
-                					       $this->activeAppLocale->getLabel().
375
-                				        '</span>'
371
+                                    pt(
372
+                                        'You are translating to %1$s', 
373
+                                        '<span class="badge badge-info">'.
374
+                                            $this->activeAppLocale->getLabel().
375
+                                        '</span>'
376 376
                                     );
377
-            				    ?><br>
377
+                                ?><br>
378 378
             					<?php pt('Found %1$s texts to translate.', $this->activeSource->countUntranslated($this->scanner)) ?>
379 379
             				</p>
380 380
             				<br>
381 381
             				<?php
382
-                				if(!$this->scanner->isScanAvailable()) 
383
-                				{
384
-                				    ?>
382
+                                if(!$this->scanner->isScanAvailable()) 
383
+                                {
384
+                                    ?>
385 385
                 				    	<div class="alert alert-primary" role="alert">
386 386
                                         	<b><?php pt('No texts found:') ?></b> 
387 387
                                         	<?php pt('The source folders have not been scanned yet.') ?>
@@ -393,15 +393,15 @@  discard block
 block discarded – undo
393 393
                                             </a>
394 394
                                         </p>
395 395
                 				    <?php 
396
-                				}
397
-                				else
398
-                				{
399
-                				    echo $this->filters->renderForm();
400
-                				    echo $this->renderList();
401
-                				}
396
+                                }
397
+                                else
398
+                                {
399
+                                    echo $this->filters->renderForm();
400
+                                    echo $this->renderList();
401
+                                }
402 402
             				
403
-        				}
404
-    				?>
403
+                        }
404
+                    ?>
405 405
 			</div>
406 406
 		</main>
407 407
 	</body>
@@ -419,22 +419,22 @@  discard block
 block discarded – undo
419 419
         	<h1><?php pt('Warnings') ?></h1>
420 420
         	<p class="abstract">
421 421
         		<?php 
422
-        		    pts('The following shows all texts where the system decided that they cannot be translated.');
423
-       		    ?>
422
+                    pts('The following shows all texts where the system decided that they cannot be translated.');
423
+                    ?>
424 424
         	</p>
425 425
         	<dl>
426 426
         		<?php 
427
-        		    $warnings = $this->scanner->getWarnings();
427
+                    $warnings = $this->scanner->getWarnings();
428 428
         		    
429
-        		    foreach($warnings as $warning)
430
-        		    {
431
-        		        ?>
429
+                    foreach($warnings as $warning)
430
+                    {
431
+                        ?>
432 432
         		        	<dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt>
433 433
         		        	<dd><?php echo $warning->getMessage() ?></dd>
434 434
         		        <?php 
435
-        		    }
435
+                    }
436 436
         		        
437
-        		?>
437
+                ?>
438 438
         	</dl>
439 439
     	<?php 
440 440
     	
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
 			<form method="post">
494 494
 				<div class="form-hiddens">
495 495
 					<?php 
496
-    					$params = $this->getRequestParams();
497
-    					foreach($params as $name => $value) {
498
-    					    ?>
496
+                        $params = $this->getRequestParams();
497
+                        foreach($params as $name => $value) {
498
+                            ?>
499 499
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
500 500
     					    <?php 
501
-    					}
502
-					?>
501
+                        }
502
+                    ?>
503 503
 				</div>
504 504
             	<table class="table table-hover">
505 505
     				<thead>
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
     				</thead>
513 513
     				<tbody>
514 514
     					<?php 
515
-    					    foreach($keep as $string)
516
-    					    {
517
-    					        $this->renderListEntry($string);
518
-    					    }
519
-    					?>
515
+                            foreach($keep as $string)
516
+                            {
517
+                                $this->renderListEntry($string);
518
+                            }
519
+                        ?>
520 520
     				</tbody>
521 521
     			</table>
522 522
     			<?php 
523
-        			if($pager->hasPages()) 
524
-        			{
525
-        			    $prevUrl = $this->getPaginationURL($pager->getPreviousPage());
526
-        			    $nextUrl = $this->getPaginationURL($pager->getNextPage());
523
+                    if($pager->hasPages()) 
524
+                    {
525
+                        $prevUrl = $this->getPaginationURL($pager->getPreviousPage());
526
+                        $nextUrl = $this->getPaginationURL($pager->getNextPage());
527 527
         			    
528
-        			    ?>
528
+                        ?>
529 529
         			    	<nav aria-label="<?php pt('Navigate available pages of texts.') ?>">
530 530
                                 <ul class="pagination">
531 531
                                     <li class="page-item">
@@ -534,20 +534,20 @@  discard block
 block discarded – undo
534 534
                                 		</a>
535 535
                             		</li>
536 536
                             		<?php 
537
-                            		    $numbers = $pager->getPageNumbers();
538
-                            		    foreach($numbers as $number) 
539
-                            		    {
540
-                            		        $url = $this->getPaginationURL($number);
537
+                                        $numbers = $pager->getPageNumbers();
538
+                                        foreach($numbers as $number) 
539
+                                        {
540
+                                            $url = $this->getPaginationURL($number);
541 541
                             		        
542
-                            		        ?>
542
+                                            ?>
543 543
                             		        	<li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>">
544 544
                             		        		<a class="page-link" href="<?php echo $url ?>">
545 545
                             		        			<?php echo $number ?>
546 546
                         		        			</a>
547 547
                         		        		</li>
548 548
                             		        <?php 
549
-                            		    }
550
-                            		?>
549
+                                        }
550
+                                    ?>
551 551
                                     <li class="page-item">
552 552
                                     	<a class="page-link" href="<?php echo $nextUrl ?>">
553 553
                                     		<i class="fa fa-arrow-right"></i>
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
                                 </ul>
557 557
                             </nav>
558 558
         			    <?php 
559
-        			}
560
-    			?>
559
+                    }
560
+                ?>
561 561
 				<br>
562 562
 				<p>
563 563
 					<button type="submit" name="<?php echo $this->getVarName('save') ?>" value="yes" class="btn btn-primary">
@@ -615,48 +615,48 @@  discard block
 block discarded – undo
615 615
         			<div class="files-list">
616 616
             			<p>
617 617
             				<?php 
618
-            				    $totalFiles = count($files);
618
+                                $totalFiles = count($files);
619 619
             				    
620
-            				    if($totalFiles == 1)
621
-            				    {
622
-            				        pt('Found in a single file:');
623
-            				    }
624
-            				    else
625
-            				    {
626
-            				        pt('Found in %1$s files:', $totalFiles);
627
-            				    }
628
-    				        ?>
620
+                                if($totalFiles == 1)
621
+                                {
622
+                                    pt('Found in a single file:');
623
+                                }
624
+                                else
625
+                                {
626
+                                    pt('Found in %1$s files:', $totalFiles);
627
+                                }
628
+                            ?>
629 629
             			</p>
630 630
         				<div class="files-scroller">
631 631
                 			<ul>
632 632
                 				<?php 
633
-                				    $locations = $string->getStrings();
633
+                                    $locations = $string->getStrings();
634 634
                 				    
635
-                    				foreach($locations as $location) 
636
-                    				{
637
-                    				    $file = $location->getSourceFile();
638
-                    				    $line = $location->getLine();
635
+                                    foreach($locations as $location) 
636
+                                    {
637
+                                        $file = $location->getSourceFile();
638
+                                        $line = $location->getLine();
639 639
                     				    
640
-                    				    $icon = '';
640
+                                        $icon = '';
641 641
                     				    
642
-                    				    $ext = \AppUtils\FileHelper::getExtension($file);
642
+                                        $ext = \AppUtils\FileHelper::getExtension($file);
643 643
                     				    
644
-                    				    if($ext == 'php') {
645
-                    				        $icon = 'fab fa-php';
646
-                    				    } else if($ext == 'js') {
647
-                    				        $icon = 'fab fa-js-square';
648
-                    				    } else {
649
-                    				        $icon = 'fas fa-file-code';
650
-                    				    }
644
+                                        if($ext == 'php') {
645
+                                            $icon = 'fab fa-php';
646
+                                        } else if($ext == 'js') {
647
+                                            $icon = 'fab fa-js-square';
648
+                                        } else {
649
+                                            $icon = 'fas fa-file-code';
650
+                                        }
651 651
                     				    
652
-                    				    ?>
652
+                                        ?>
653 653
                     				    	<li>
654 654
                     				    		<i class="<?php echo $icon ?>"></i>
655 655
                     				    		<?php echo $file ?><span class="line-number">:<?php echo $line ?></span>
656 656
                     				    	</li>
657 657
                     				    <?php 
658
-                    				}
659
-                				?>
658
+                                    }
659
+                                ?>
660 660
                 			</ul>
661 661
             			</div>
662 662
         			</div>
@@ -867,13 +867,13 @@  discard block
 block discarded – undo
867 867
         );
868 868
     }
869 869
     
870
-   /**
871
-    * Sets the application name shown in the main navigation
872
-    * in the user interface.
873
-    * 
874
-    * @param string $name
875
-    * @return Localization_Editor
876
-    */
870
+    /**
871
+     * Sets the application name shown in the main navigation
872
+     * in the user interface.
873
+     * 
874
+     * @param string $name
875
+     * @return Localization_Editor
876
+     */
877 877
     public function setAppName(string $name) : Localization_Editor
878 878
     {
879 879
         $this->setOption('appname', $name);
@@ -890,27 +890,27 @@  discard block
 block discarded – undo
890 890
         return t('Localization editor');
891 891
     }
892 892
 
893
-   /**
894
-    * Selects the default source to use if none has been 
895
-    * explicitly selected.
896
-    * 
897
-    * @param string $sourceID
898
-    */
893
+    /**
894
+     * Selects the default source to use if none has been 
895
+     * explicitly selected.
896
+     * 
897
+     * @param string $sourceID
898
+     */
899 899
     public function selectDefaultSource(string $sourceID) : Localization_Editor
900 900
     {
901 901
         $this->setOption('default-source', $sourceID);
902 902
         return $this;
903 903
     }
904 904
     
905
-   /**
906
-    * Sets an URL that the translators can use to go back to
907
-    * the main application, for example if it is integrated into
908
-    * an existing application.
909
-    * 
910
-    * @param string $url The URL to use for the link
911
-    * @param string $label Label of the link
912
-    * @return Localization_Editor
913
-    */
905
+    /**
906
+     * Sets an URL that the translators can use to go back to
907
+     * the main application, for example if it is integrated into
908
+     * an existing application.
909
+     * 
910
+     * @param string $url The URL to use for the link
911
+     * @param string $label Label of the link
912
+     * @return Localization_Editor
913
+     */
914 914
     public function setBackURL(string $url, string $label) : Localization_Editor
915 915
     {
916 916
         $this->setOption('back-url', $url);
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
     
108 108
     protected function initSession()
109 109
     {
110
-        if(session_status() != PHP_SESSION_ACTIVE) {
110
+        if (session_status() != PHP_SESSION_ACTIVE) {
111 111
             session_start();
112 112
         }
113 113
         
114
-        if(!isset($_SESSION['localization_messages'])) {
114
+        if (!isset($_SESSION['localization_messages'])) {
115 115
             $_SESSION['localization_messages'] = array();
116 116
         }
117 117
     }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $this->sources = Localization::getSources();
127 127
         
128
-        if(empty($this->sources)) 
128
+        if (empty($this->sources)) 
129 129
         {
130 130
             throw new Localization_Exception(
131 131
                 'Cannot start editor: no sources defined.',
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         }
136 136
         
137 137
         $activeID = $this->request->registerParam($this->getVarName('source'))->setEnum(Localization::getSourceIDs())->get();
138
-        if(empty($activeID)) {
138
+        if (empty($activeID)) {
139 139
             $activeID = $this->getDefaultSourceID();
140 140
         }
141 141
         
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     protected function getDefaultSourceID()
146 146
     {
147 147
         $default = $this->getOption('default-source');
148
-        if(!empty($default) && Localization::sourceAliasExists($default)) {
148
+        if (!empty($default) && Localization::sourceAliasExists($default)) {
149 149
             return Localization::getSourceByAlias($default)->getID();
150 150
         }
151 151
         
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
         $names = array();
158 158
         
159 159
         $locales = Localization::getAppLocales();
160
-        foreach($locales as $locale) {
161
-            if(!$locale->isNative()) {
160
+        foreach ($locales as $locale) {
161
+            if (!$locale->isNative()) {
162 162
                 $this->appLocales[] = $locale;
163 163
                 $names[] = $locale->getName();
164 164
             }
165 165
         }
166 166
         
167 167
         // use the default locale if no other is available.
168
-        if(empty($names)) {
168
+        if (empty($names)) {
169 169
             $this->activeAppLocale = Localization::getAppLocale();
170 170
             return;
171 171
         }
172 172
        
173 173
         $activeID = $this->request->registerParam($this->getVarName('locale'))->setEnum($names)->get();
174
-        if(empty($activeID)) {
174
+        if (empty($activeID)) {
175 175
             $activeID = $this->appLocales[0]->getName();
176 176
         }
177 177
         
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
         
190 190
         $this->filters = new Localization_Editor_Filters($this);
191 191
         
192
-        if($this->request->getBool($this->getVarName('scan'))) 
192
+        if ($this->request->getBool($this->getVarName('scan'))) 
193 193
         {
194 194
             $this->executeScan();
195 195
         } 
196
-        else if($this->request->getBool($this->getVarName('save'))) 
196
+        else if ($this->request->getBool($this->getVarName('save'))) 
197 197
         {
198 198
             $this->executeSave();
199 199
         }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			
232 232
             <div class="collapse navbar-collapse" id="navbarsExampleDefault">
233 233
                 <?php 
234
-                    if(!empty($this->appLocales))
234
+                    if (!empty($this->appLocales))
235 235
                     {
236 236
                         ?>
237 237
                             <ul class="navbar-nav mr-auto">
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
                                 	</a>
242 242
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
243 243
                                     	<?php 
244
-                                    	    foreach($this->sources as $source)
244
+                                    	    foreach ($this->sources as $source)
245 245
                                     	    {
246 246
                                     	       ?>
247 247
                                         			<a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>">
248 248
                                         				<?php 
249
-                                            				if($source->getID() === $this->activeSource->getID()) 
249
+                                            				if ($source->getID() === $this->activeSource->getID()) 
250 250
                                             				{
251 251
                                             				    ?>
252 252
                                             				    	<b><?php echo $source->getLabel() ?></b>
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                                         				?>
260 260
                                         				<?php
261 261
                                         				    $untranslated = $source->countUntranslated($this->scanner);
262
-                                        				    if($untranslated > 0) {
262
+                                        				    if ($untranslated > 0) {
263 263
                                         				        ?>
264 264
                                         				        	(<span class="text-danger" title="<?php pt('%1$s texts have not been translated in this text source.', $untranslated) ?>"><?php echo $untranslated ?></span>)
265 265
                                 				            	<?php 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                                 	</a>
278 278
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
279 279
                                     	<?php 
280
-                                    	    foreach($this->appLocales as $locale)
280
+                                    	    foreach ($this->appLocales as $locale)
281 281
                                     	    {
282 282
                                     	       ?>
283 283
                                         			<a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>">
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                                     </a>
296 296
                     			</li>
297 297
                     			<?php 
298
-                        			if($this->scanner->hasWarnings()) {
298
+                        			if ($this->scanner->hasWarnings()) {
299 299
                         			    ?>
300 300
                         			    	<li class="nav-item">
301 301
                         			    		<a href="<?php echo $this->getWarningsURL() ?>">
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
                 ?>
315 315
                 <?php 
316 316
                     $backURL = $this->getOption('back-url');
317
-                    if(!empty($backURL)) 
317
+                    if (!empty($backURL)) 
318 318
                     {
319 319
                         ?>
320 320
                             <a href="<?php echo $backURL ?>" class="btn btn-light btn-sm">
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		<main role="main" class="container">
330 330
 			<div>
331 331
     			<?php 
332
-    			    if(empty($this->appLocales))
332
+    			    if (empty($this->appLocales))
333 333
     			    {
334 334
     			        ?>
335 335
     			        	<div class="alert alert-danger">
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     			        	</div>
340 340
     			        <?php 
341 341
     			    }
342
-    			    else if($this->request->getBool($this->getVarName('warnings')))
342
+    			    else if ($this->request->getBool($this->getVarName('warnings')))
343 343
     			    {
344 344
     			        echo $this->renderWarnings();
345 345
     			    }
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
     			        ?>
349 349
             				<h1><?php echo $this->activeSource->getLabel() ?></h1>
350 350
             				<?php 
351
-                				if(!empty($_SESSION['localization_messages'])) 
351
+                				if (!empty($_SESSION['localization_messages'])) 
352 352
                 				{
353
-                				    foreach($_SESSION['localization_messages'] as $def)
353
+                				    foreach ($_SESSION['localization_messages'] as $def)
354 354
                 				    {
355 355
                 				        ?>
356 356
                 				        	<div class="alert alert-<?php echo $def['type'] ?>" role="alert">
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             				</p>
380 380
             				<br>
381 381
             				<?php
382
-                				if(!$this->scanner->isScanAvailable()) 
382
+                				if (!$this->scanner->isScanAvailable()) 
383 383
                 				{
384 384
                 				    ?>
385 385
                 				    	<div class="alert alert-primary" role="alert">
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         		<?php 
427 427
         		    $warnings = $this->scanner->getWarnings();
428 428
         		    
429
-        		    foreach($warnings as $warning)
429
+        		    foreach ($warnings as $warning)
430 430
         		    {
431 431
         		        ?>
432 432
         		        	<dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt>
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
         
448 448
         $result = array();
449 449
         
450
-        foreach($strings as $string)
450
+        foreach ($strings as $string)
451 451
         {
452
-            if($this->filters->isStringMatch($string)) {
452
+            if ($this->filters->isStringMatch($string)) {
453 453
                 $result[] = $string;
454 454
             }
455 455
         }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     {
473 473
         $strings = $this->getFilteredStrings();
474 474
         
475
-        if(empty($strings))
475
+        if (empty($strings))
476 476
         {
477 477
             ?>
478 478
             	<div class="alert alert-info">
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 				<div class="form-hiddens">
495 495
 					<?php 
496 496
     					$params = $this->getRequestParams();
497
-    					foreach($params as $name => $value) {
497
+    					foreach ($params as $name => $value) {
498 498
     					    ?>
499 499
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
500 500
     					    <?php 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
     				</thead>
513 513
     				<tbody>
514 514
     					<?php 
515
-    					    foreach($keep as $string)
515
+    					    foreach ($keep as $string)
516 516
     					    {
517 517
     					        $this->renderListEntry($string);
518 518
     					    }
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     				</tbody>
521 521
     			</table>
522 522
     			<?php 
523
-        			if($pager->hasPages()) 
523
+        			if ($pager->hasPages()) 
524 524
         			{
525 525
         			    $prevUrl = $this->getPaginationURL($pager->getPreviousPage());
526 526
         			    $nextUrl = $this->getPaginationURL($pager->getNextPage());
@@ -535,12 +535,12 @@  discard block
 block discarded – undo
535 535
                             		</li>
536 536
                             		<?php 
537 537
                             		    $numbers = $pager->getPageNumbers();
538
-                            		    foreach($numbers as $number) 
538
+                            		    foreach ($numbers as $number) 
539 539
                             		    {
540 540
                             		        $url = $this->getPaginationURL($number);
541 541
                             		        
542 542
                             		        ?>
543
-                            		        	<li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>">
543
+                            		        	<li class="page-item <?php if ($pager->isCurrentPage($number)) { echo 'active'; } ?>">
544 544
                             		        		<a class="page-link" href="<?php echo $url ?>">
545 545
                             		        			<?php echo $number ?>
546 546
                         		        			</a>
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         <?php 
571 571
     }
572 572
     
573
-    protected function getPaginationURL(int $page, $params=array())
573
+    protected function getPaginationURL(int $page, $params = array())
574 574
     {
575 575
         $params[$this->getVarName('page')] = $page;
576 576
         
@@ -582,11 +582,11 @@  discard block
 block discarded – undo
582 582
         $hash = $string->getHash();
583 583
         
584 584
         $previewText = $string->getTranslatedText();
585
-        if(empty($previewText)) {
585
+        if (empty($previewText)) {
586 586
             $previewText = $string->getText();
587 587
         }
588 588
         
589
-        $shortText =  $this->renderText($previewText, 50);
589
+        $shortText = $this->renderText($previewText, 50);
590 590
         
591 591
         $files = $string->getFiles();
592 592
         
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
             				<?php 
618 618
             				    $totalFiles = count($files);
619 619
             				    
620
-            				    if($totalFiles == 1)
620
+            				    if ($totalFiles == 1)
621 621
             				    {
622 622
             				        pt('Found in a single file:');
623 623
             				    }
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
                 				<?php 
633 633
                 				    $locations = $string->getStrings();
634 634
                 				    
635
-                    				foreach($locations as $location) 
635
+                    				foreach ($locations as $location) 
636 636
                     				{
637 637
                     				    $file = $location->getSourceFile();
638 638
                     				    $line = $location->getLine();
@@ -641,9 +641,9 @@  discard block
 block discarded – undo
641 641
                     				    
642 642
                     				    $ext = \AppUtils\FileHelper::getExtension($file);
643 643
                     				    
644
-                    				    if($ext == 'php') {
644
+                    				    if ($ext == 'php') {
645 645
                     				        $icon = 'fab fa-php';
646
-                    				    } else if($ext == 'js') {
646
+                    				    } else if ($ext == 'js') {
647 647
                     				        $icon = 'fab fa-js-square';
648 648
                     				    } else {
649 649
                     				        $icon = 'fas fa-file-code';
@@ -666,13 +666,13 @@  discard block
 block discarded – undo
666 666
         
667 667
     }
668 668
     
669
-    protected function renderText(string $text, int $cutAt=0) : string
669
+    protected function renderText(string $text, int $cutAt = 0) : string
670 670
     {
671
-        if(empty($text)) {
671
+        if (empty($text)) {
672 672
             return $text;
673 673
         }
674 674
         
675
-        if($cutAt > 0) {
675
+        if ($cutAt > 0) {
676 676
             $text = \AppUtils\ConvertHelper::text_cut($text, $cutAt);
677 677
         }
678 678
         
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
         
681 681
         $vars = $this->detectVariables($text);
682 682
         
683
-        foreach($vars as $var) {
683
+        foreach ($vars as $var) {
684 684
             $text = str_replace($var, '<span class="placeholder">'.$var.'</span>', $text);
685 685
         }
686 686
         
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
         $result = array();
693 693
         preg_match_all('/%[0-9]+d|%s|%[0-9]+\$s/i', $string, $result, PREG_PATTERN_ORDER);
694 694
 
695
-        if(isset($result[0]) && !empty($result[0])) {
695
+        if (isset($result[0]) && !empty($result[0])) {
696 696
             return $result[0];
697 697
         }
698 698
         
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
         
709 709
         // add a counter of the additional files if the total
710 710
         // is higher than the maximum to show
711
-        if($total > $max) 
711
+        if ($total > $max) 
712 712
         {
713 713
             $length = $max;
714
-            if($length > $keepTotal) {
714
+            if ($length > $keepTotal) {
715 715
                 $length = $keepTotal; 
716 716
             }
717 717
             
@@ -739,14 +739,14 @@  discard block
 block discarded – undo
739 739
         return file_get_contents($this->installPath.'/css/editor.css');
740 740
     }
741 741
     
742
-    public function getSourceURL(Localization_Source $source, array $params=array())
742
+    public function getSourceURL(Localization_Source $source, array $params = array())
743 743
     {
744 744
         $params[$this->getVarName('source')] = $source->getID();
745 745
         
746 746
         return $this->getURL($params);
747 747
     }
748 748
     
749
-    public function getLocaleURL(Localization_Locale $locale, array $params=array())
749
+    public function getLocaleURL(Localization_Locale $locale, array $params = array())
750 750
     {
751 751
         $params[$this->getVarName('locale')] = $locale->getName();
752 752
         
@@ -763,12 +763,12 @@  discard block
 block discarded – undo
763 763
         return $this->getSourceURL($this->activeSource, array($this->getVarName('warnings') => 'yes'));
764 764
     }
765 765
     
766
-    public function getURL(array $params=array())
766
+    public function getURL(array $params = array())
767 767
     {
768 768
         $persist = $this->getRequestParams();
769 769
         
770
-        foreach($persist as $name => $value) {
771
-            if(!isset($params[$name])) {
770
+        foreach ($persist as $name => $value) {
771
+            if (!isset($params[$name])) {
772 772
                 $params[$name] = $value;
773 773
             }
774 774
         }
@@ -801,11 +801,11 @@  discard block
 block discarded – undo
801 801
         $translator = Localization::getTranslator($this->activeAppLocale);
802 802
         
803 803
         $strings = $data[$this->getVarName('strings')];
804
-        foreach($strings as $hash => $text) 
804
+        foreach ($strings as $hash => $text) 
805 805
         {
806 806
             $text = trim($text);
807 807
             
808
-            if(empty($text)) {
808
+            if (empty($text)) {
809 809
                 continue;
810 810
             } 
811 811
             
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
     
828 828
     protected function renderStatus(Localization_Scanner_StringHash $hash)
829 829
     {
830
-        if($hash->isTranslated()) {
830
+        if ($hash->isTranslated()) {
831 831
             return '<i class="fa fa-check text-success"></i>';
832 832
         }        
833 833
         
@@ -838,18 +838,18 @@  discard block
 block discarded – undo
838 838
     {
839 839
         $types = array();
840 840
         
841
-        if($hash->hasLanguageType('PHP')) {
841
+        if ($hash->hasLanguageType('PHP')) {
842 842
             $types[] = t('Server');
843 843
         }
844 844
         
845
-        if($hash->hasLanguageType('Javascript')) {
845
+        if ($hash->hasLanguageType('Javascript')) {
846 846
             $types[] = t('Client');
847 847
         }
848 848
         
849 849
         return implode(', ', $types);
850 850
     }
851 851
     
852
-    protected function addMessage($message, $type=self::MESSAGE_INFO)
852
+    protected function addMessage($message, $type = self::MESSAGE_INFO)
853 853
     {
854 854
         $_SESSION['localization_messages'][] = array(
855 855
             'text' => $message,
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
     public function getAppName() : string
884 884
     {
885 885
         $name = $this->getOption('appname');
886
-        if(!empty($name)) {
886
+        if (!empty($name)) {
887 887
             return $name;
888 888
         }
889 889
         
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -192,8 +192,7 @@  discard block
 block discarded – undo
192 192
         if($this->request->getBool($this->getVarName('scan'))) 
193 193
         {
194 194
             $this->executeScan();
195
-        } 
196
-        else if($this->request->getBool($this->getVarName('save'))) 
195
+        } else if($this->request->getBool($this->getVarName('save'))) 
197 196
         {
198 197
             $this->executeSave();
199 198
         }
@@ -251,8 +250,7 @@  discard block
 block discarded – undo
251 250
                                             				    ?>
252 251
                                             				    	<b><?php echo $source->getLabel() ?></b>
253 252
                                         				    	<?php 
254
-                                            				}
255
-                                            				else
253
+                                            				} else
256 254
                                             				{
257 255
                                             				    echo $source->getLabel();
258 256
                                             				}
@@ -338,12 +336,10 @@  discard block
 block discarded – undo
338 336
     			        		<?php pt('No application locales were added to translate to.') ?>
339 337
     			        	</div>
340 338
     			        <?php 
341
-    			    }
342
-    			    else if($this->request->getBool($this->getVarName('warnings')))
339
+    			    } else if($this->request->getBool($this->getVarName('warnings')))
343 340
     			    {
344 341
     			        echo $this->renderWarnings();
345
-    			    }
346
-    			    else
342
+    			    } else
347 343
     			    {
348 344
     			        ?>
349 345
             				<h1><?php echo $this->activeSource->getLabel() ?></h1>
@@ -393,8 +389,7 @@  discard block
 block discarded – undo
393 389
                                             </a>
394 390
                                         </p>
395 391
                 				    <?php 
396
-                				}
397
-                				else
392
+                				} else
398 393
                 				{
399 394
                 				    echo $this->filters->renderForm();
400 395
                 				    echo $this->renderList();
@@ -620,8 +615,7 @@  discard block
 block discarded – undo
620 615
             				    if($totalFiles == 1)
621 616
             				    {
622 617
             				        pt('Found in a single file:');
623
-            				    }
624
-            				    else
618
+            				    } else
625 619
             				    {
626 620
             				        pt('Found in %1$s files:', $totalFiles);
627 621
             				    }
Please login to merge, or discard this patch.
src/Localization/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     protected $details;
8 8
     
9
-    public function __construct($message, $details=null, $code=null, $previous=null)
9
+    public function __construct($message, $details = null, $code = null, $previous = null)
10 10
     {
11 11
         parent::__construct($message, $code, $previous);
12 12
         $this->details = $details;
Please login to merge, or discard this patch.
src/Localization/Editor/Filters.php 3 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Localization_Editor_Filters
8 8
 {
9
-   /**
10
-    * @var Localization_Editor
11
-    */
9
+    /**
10
+     * @var Localization_Editor
11
+     */
12 12
     protected $editor;
13 13
     
14
-   /**
15
-    * @var \AppUtils\Request
16
-    */
14
+    /**
15
+     * @var \AppUtils\Request
16
+     */
17 17
     
18 18
     protected $request; 
19 19
      
20
-   /**
21
-    * @var string
22
-    */
20
+    /**
21
+     * @var string
22
+     */
23 23
     protected $sessionName = 'localize_filters';
24 24
     
25 25
     protected $vars = array(
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
             <form class="form-inline">
175 175
             	<div class="form-hiddens">
176 176
             		<?php 
177
-    					$params = $this->editor->getRequestParams();
178
-    					foreach($params as $name => $value) {
179
-    					    ?>
177
+                        $params = $this->editor->getRequestParams();
178
+                        foreach($params as $name => $value) {
179
+                            ?>
180 180
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
181 181
     					    <?php 
182
-    					}
183
-					?>
182
+                        }
183
+                    ?>
184 184
             	</div>
185 185
             	<div class="form-row">
186 186
             		<div class="col-auto">
@@ -188,42 +188,42 @@  discard block
 block discarded – undo
188 188
     		        </div>
189 189
                     <div class="col-auto">
190 190
                     	<?php
191
-                    	    echo $this->renderSelect(
192
-                    	       $this->vars['status'],
193
-                    	       array(
194
-                        	       array(
195
-                        	            'value' => '',
196
-                        	            'label' => t('Status...')
197
-                        	       ),
198
-                        	       array(
199
-                        	           'value' => 'untranslated',
200
-                        	           'label' => t('Not translated')
201
-                        	       ),
202
-                        	       array(
203
-                        	           'value' => 'translated',
204
-                        	           'label' => t('Translated')
205
-                        	       )
206
-                    	       )
207
-                    	   );
191
+                            echo $this->renderSelect(
192
+                                $this->vars['status'],
193
+                                array(
194
+                                    array(
195
+                                        'value' => '',
196
+                                        'label' => t('Status...')
197
+                                    ),
198
+                                    array(
199
+                                        'value' => 'untranslated',
200
+                                        'label' => t('Not translated')
201
+                                    ),
202
+                                    array(
203
+                                        'value' => 'translated',
204
+                                        'label' => t('Translated')
205
+                                    )
206
+                                )
207
+                            );
208 208
                     	
209
-                    	   echo $this->renderSelect(
210
-                    	       $this->vars['location'],
211
-                    	       array(
212
-                    	           array(
213
-                    	               'value' => '',
214
-                    	               'label' => t('Location...')
215
-                    	           ),
216
-                    	           array(
217
-                    	               'value' => 'client',
218
-                    	               'label' => t('Clientside')
219
-                    	           ),
220
-                    	           array(
221
-                    	               'value' => 'server',
222
-                    	               'label' => t('Serverside')
223
-                    	           )
224
-                    	       )
225
-                	       );
226
-                    	?>
209
+                            echo $this->renderSelect(
210
+                                $this->vars['location'],
211
+                                array(
212
+                                    array(
213
+                                        'value' => '',
214
+                                        'label' => t('Location...')
215
+                                    ),
216
+                                    array(
217
+                                        'value' => 'client',
218
+                                        'label' => t('Clientside')
219
+                                    ),
220
+                                    array(
221
+                                        'value' => 'server',
222
+                                        'label' => t('Serverside')
223
+                                    )
224
+                                )
225
+                            );
226
+                        ?>
227 227
                     </div>
228 228
                     <div class="col-auto">
229 229
 	    				<button type="submit" name="<?php echo $this->vars['filter'] ?>" value="yes" class="btn btn-primary mb-2" title="<?php pt('Filter the list with the selected criteria.') ?>" data-toggle="tooltip">
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -35,23 +35,23 @@  discard block
 block discarded – undo
35 35
         $this->editor = $editor;
36 36
         $this->request = $editor->getRequest();
37 37
         
38
-        foreach($this->vars as $var => $name) {
38
+        foreach ($this->vars as $var => $name) {
39 39
             $this->vars[$var] = $this->editor->getVarName($var);
40 40
         }
41 41
 
42
-        if(!isset($_SESSION[$this->sessionName])) {
42
+        if (!isset($_SESSION[$this->sessionName])) {
43 43
             $_SESSION[$this->sessionName] = array();
44 44
         }
45 45
 
46
-        if($this->request->getBool($this->vars['resetfilter']))
46
+        if ($this->request->getBool($this->vars['resetfilter']))
47 47
         {
48 48
             $defaults = $this->getDefaultValues();
49 49
             
50
-            foreach($defaults as $name => $val) {
50
+            foreach ($defaults as $name => $val) {
51 51
                 $this->setValue($name, $val);
52 52
             }
53 53
         }
54
-        else if($this->request->getBool($this->vars['filter'])) 
54
+        else if ($this->request->getBool($this->vars['filter'])) 
55 55
         {
56 56
             $this->parseSearchTerms($this->request->getParam($this->vars['search']));
57 57
             
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
     
87 87
     protected function getValue(string $filterName) : string
88 88
     {
89
-        if(isset($_SESSION[$this->sessionName][$filterName])) {
89
+        if (isset($_SESSION[$this->sessionName][$filterName])) {
90 90
             return $_SESSION[$this->sessionName][$filterName];
91 91
         }
92 92
         
93 93
         $defaults = $this->getDefaultValues();
94
-        if(isset($defaults[$filterName])) {
94
+        if (isset($defaults[$filterName])) {
95 95
             return $defaults[$filterName];
96 96
         }
97 97
         
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     
104 104
     protected function parseSearchTerms(string $searchString)
105 105
     {
106
-        if(empty($searchString)) 
106
+        if (empty($searchString)) 
107 107
         {
108 108
             $this->searchTerms = array();
109 109
             $this->searchString = '';
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
         $terms = array_map('trim', $terms);
118 118
         
119 119
         $keep = array();
120
-        foreach($terms as $term) {
121
-            if(!empty($term)) {
120
+        foreach ($terms as $term) {
121
+            if (!empty($term)) {
122 122
                 $keep[] = $term;
123 123
             }
124 124
         }
@@ -129,28 +129,28 @@  discard block
 block discarded – undo
129 129
     
130 130
     public function isStringMatch(Localization_Scanner_StringHash $string)
131 131
     {
132
-        if(!empty($this->searchTerms)) 
132
+        if (!empty($this->searchTerms)) 
133 133
         {
134 134
             $haystack = $string->getSearchString();
135 135
             
136
-            foreach($this->searchTerms as $term) {
137
-                if(!mb_stristr($haystack, $term)) {
136
+            foreach ($this->searchTerms as $term) {
137
+                if (!mb_stristr($haystack, $term)) {
138 138
                     return false;
139 139
                 }
140 140
             }
141 141
         }
142 142
         
143 143
         $status = $this->getValue($this->vars['status']);
144
-        if($status === 'untranslated' && $string->isTranslated()) {
144
+        if ($status === 'untranslated' && $string->isTranslated()) {
145 145
             return false;
146
-        } else if($status === 'translated' && !$string->isTranslated()) {
146
+        } else if ($status === 'translated' && !$string->isTranslated()) {
147 147
             return false;
148 148
         }
149 149
         
150 150
         $location = $this->getValue($this->vars['location']);
151
-        if($location === 'client' && !$string->hasLanguageType('Javascript')) {
151
+        if ($location === 'client' && !$string->hasLanguageType('Javascript')) {
152 152
             return false;
153
-        } else if($location === 'server' && !$string->hasLanguageType('PHP')) {
153
+        } else if ($location === 'server' && !$string->hasLanguageType('PHP')) {
154 154
             return false;
155 155
         }
156 156
         
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             	<div class="form-hiddens">
176 176
             		<?php 
177 177
     					$params = $this->editor->getRequestParams();
178
-    					foreach($params as $name => $value) {
178
+    					foreach ($params as $name => $value) {
179 179
     					    ?>
180 180
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
181 181
     					    <?php 
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
         ?>
252 252
         	<select class="form-control" name="<?php echo $filterName ?>">
253 253
         		<?php 
254
-                    foreach($entries as $entry) 
254
+                    foreach ($entries as $entry) 
255 255
                     {
256 256
                         $selected = '';
257
-                        if($entry['value'] === $value) {
257
+                        if ($entry['value'] === $value) {
258 258
                             $selected = ' selected';
259 259
                         }
260 260
                         
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
             foreach($defaults as $name => $val) {
51 51
                 $this->setValue($name, $val);
52 52
             }
53
-        }
54
-        else if($this->request->getBool($this->vars['filter'])) 
53
+        } else if($this->request->getBool($this->vars['filter'])) 
55 54
         {
56 55
             $this->parseSearchTerms($this->request->getParam($this->vars['search']));
57 56
             
@@ -72,8 +71,7 @@  discard block
 block discarded – undo
72 71
                 ->setEnum('', 'client', 'server')
73 72
                 ->get('')
74 73
             );
75
-        }
76
-        else
74
+        } else
77 75
         {
78 76
             $this->parseSearchTerms($this->getValue($this->vars['search']));
79 77
         }
Please login to merge, or discard this patch.
src/Localization/Scanner.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
         \AppUtils\FileHelper::saveAsJSON($data, $this->storageFile);
74 74
     }
75 75
     
76
-   /**
77
-    * @var Localization_Parser
78
-    */
76
+    /**
77
+     * @var Localization_Parser
78
+     */
79 79
     protected $parser;
80 80
 
81 81
     public function getParser()
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
         return $this->parser;
88 88
     }
89 89
     
90
-   /**
91
-    * @var Localization_Scanner_StringsCollection
92
-    */
90
+    /**
91
+     * @var Localization_Scanner_StringsCollection
92
+     */
93 93
     protected $collection;
94 94
     
95 95
     public function getCollection() : Localization_Scanner_StringsCollection
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         return $this->getCollection()->countWarnings();
137 137
     }
138 138
     
139
-   /**
140
-    * Retrieves all warnings that have been registered
141
-    * during the last search for translateable texts.
142
-    * 
143
-    * @return \AppLocalize\Localization_Scanner_StringsCollection_Warning[]
144
-    */
139
+    /**
140
+     * Retrieves all warnings that have been registered
141
+     * during the last search for translateable texts.
142
+     * 
143
+     * @return \AppLocalize\Localization_Scanner_StringsCollection_Warning[]
144
+     */
145 145
     public function getWarnings()
146 146
     {
147 147
         return $this->getCollection()->getWarnings();
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
     
25 25
     public function scan()
26 26
     {
27
-        if(isset($this->collection)) {
27
+        if (isset($this->collection)) {
28 28
             $this->collection = null;
29 29
         }
30 30
         
31 31
         $this->timeStart = microtime(true);
32 32
         
33 33
         $sources = Localization::getSources();
34
-        foreach($sources as $source) 
34
+        foreach ($sources as $source) 
35 35
         {
36 36
             $source->scan($this);
37 37
         }
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
     
46 46
     public function load()
47 47
     {
48
-        if(!$this->isScanAvailable()) {
48
+        if (!$this->isScanAvailable()) {
49 49
             return;
50 50
         }
51 51
         
52
-        if($this->loaded) {
52
+        if ($this->loaded) {
53 53
             return;
54 54
         }
55 55
         
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         
58 58
         $data = \AppUtils\FileHelper::parseJSONFile($this->storageFile);
59 59
         
60
-        if($this->getCollection()->fromArray($data) === true) {
60
+        if ($this->getCollection()->fromArray($data) === true) {
61 61
             return;
62 62
         }
63 63
         
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function getParser()
82 82
     {
83
-        if(!isset($this->parser)) {
83
+        if (!isset($this->parser)) {
84 84
             $this->parser = new Localization_Parser($this);
85 85
         }
86 86
         
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     
95 95
     public function getCollection() : Localization_Scanner_StringsCollection
96 96
     {
97
-        if(!isset($this->collection)) {
97
+        if (!isset($this->collection)) {
98 98
             $this->collection = new Localization_Scanner_StringsCollection($this);
99 99
         }
100 100
         
Please login to merge, or discard this patch.