Passed
Push — master ( 82b8bb...ff0cce )
by Sebastian
03:28
created
src/Localization/Generator.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     protected function initCache() : void
67 67
     {
68 68
         // ignore it if it does not exist.
69
-        if(!file_exists($this->cacheKeyFile)) {
69
+        if (!file_exists($this->cacheKeyFile)) {
70 70
             return;
71 71
         }
72 72
         
@@ -78,22 +78,22 @@  discard block
 block discarded – undo
78 78
      * @throws Localization_Exception
79 79
      * @throws FileHelper_Exception
80 80
      */
81
-    public function writeFiles(bool $force=false) : void
81
+    public function writeFiles(bool $force = false) : void
82 82
     {
83 83
         // reset the write states for all files
84 84
         $fileIDs = array_keys($this->written);
85
-        foreach($fileIDs as $fileID) {
85
+        foreach ($fileIDs as $fileID) {
86 86
             $this->written[$fileID] = false;
87 87
         }
88 88
         
89 89
         // no client libraries folder set: ignore.
90
-        if(empty($this->targetFolder)) {
90
+        if (empty($this->targetFolder)) {
91 91
             return;
92 92
         }
93 93
         
94 94
         FileHelper::createFolder($this->targetFolder);
95 95
         
96
-        if(!is_writable($this->targetFolder)) 
96
+        if (!is_writable($this->targetFolder)) 
97 97
         {
98 98
             throw new Localization_Exception(
99 99
                 sprintf(
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             );
109 109
         }
110 110
         
111
-        if($this->cacheKey !== Localization::getClientLibrariesCacheKey()) {
111
+        if ($this->cacheKey !== Localization::getClientLibrariesCacheKey()) {
112 112
             $force = true;
113 113
         }
114 114
         
@@ -131,16 +131,16 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $files = array();
133 133
         
134
-        foreach($this->libraries as $fileName)
134
+        foreach ($this->libraries as $fileName)
135 135
         {
136 136
             $files[] = $this->getLibraryFilePath($fileName);
137 137
         }
138 138
         
139 139
         $locales = Localization::getAppLocales();
140 140
         
141
-        foreach($locales as $locale)
141
+        foreach ($locales as $locale)
142 142
         {
143
-            if($locale->isNative()) {
143
+            if ($locale->isNative()) {
144 144
                 continue;
145 145
             }
146 146
             
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $locales = Localization::getAppLocales();
156 156
         
157
-        foreach($locales as $locale)
157
+        foreach ($locales as $locale)
158 158
         {
159
-            if($locale->isNative()) {
159
+            if ($locale->isNative()) {
160 160
                 continue;
161 161
             }
162 162
             
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     {
181 181
         $sourceFolder = realpath(__DIR__.'/../js');
182 182
         
183
-        if($sourceFolder === false) 
183
+        if ($sourceFolder === false) 
184 184
         {
185 185
             throw new Localization_Exception(
186 186
                 'Unexpected folder structure encountered.',
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
             );
193 193
         }
194 194
         
195
-        foreach($this->libraries as $fileName)
195
+        foreach ($this->libraries as $fileName)
196 196
         {
197 197
             $targetFile = $this->getLibraryFilePath($fileName);
198 198
             
199
-            if(file_exists($targetFile) && !$this->force) {
199
+            if (file_exists($targetFile) && !$this->force) {
200 200
                 continue;
201 201
             }
202 202
             
@@ -241,16 +241,16 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $path = $this->getLocaleFilePath($locale);
243 243
         
244
-        if(file_exists($path) && !$this->force) {
244
+        if (file_exists($path) && !$this->force) {
245 245
             return;
246 246
         }
247 247
         
248 248
         $strings = $this->translator->getClientStrings($locale);
249 249
         
250 250
         $tokens = array();
251
-        foreach($strings as $hash => $text)
251
+        foreach ($strings as $hash => $text)
252 252
         {
253
-            if(empty($text)) {
253
+            if (empty($text)) {
254 254
                 continue;
255 255
             }
256 256
             
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
             );
262 262
         }
263 263
         
264
-        if(empty($tokens))
264
+        if (empty($tokens))
265 265
         {
266 266
             $content = '/* No strings found. */';
267 267
         }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     */
287 287
     protected function writeCacheKey() : void
288 288
     {
289
-        if(file_exists($this->cacheKeyFile) && !$this->force) {
289
+        if (file_exists($this->cacheKeyFile) && !$this->force) {
290 290
             return;
291 291
         }
292 292
         
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public function areFilesWritten(string $filesID) : bool
313 313
     {
314
-        if(isset($this->written[$filesID])) {
314
+        if (isset($this->written[$filesID])) {
315 315
             return $this->written[$filesID];
316 316
         }
317 317
         
Please login to merge, or discard this patch.
src/Localization/Editor/OutputBuffering.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     {
22 22
         $html = ob_get_clean();
23 23
 
24
-        if($html !== false)
24
+        if ($html !== false)
25 25
         {
26 26
             return $html;
27 27
         }
Please login to merge, or discard this patch.
src/Localization/Editor/Filters.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
         $this->editor = $editor;
56 56
         $this->request = $editor->getRequest();
57 57
         
58
-        foreach($this->vars as $var => $name) {
58
+        foreach ($this->vars as $var => $name) {
59 59
             $this->vars[$var] = $this->editor->getVarName($var);
60 60
         }
61 61
 
62
-        if(!isset($_SESSION[$this->sessionName])) {
62
+        if (!isset($_SESSION[$this->sessionName])) {
63 63
             $_SESSION[$this->sessionName] = array();
64 64
         }
65 65
 
66
-        if($this->request->getBool($this->vars['resetfilter']))
66
+        if ($this->request->getBool($this->vars['resetfilter']))
67 67
         {
68 68
             $defaults = $this->getDefaultValues();
69 69
             
70
-            foreach($defaults as $name => $val) {
70
+            foreach ($defaults as $name => $val) {
71 71
                 $this->setValue($name, $val);
72 72
             }
73 73
         }
74
-        else if($this->request->getBool($this->vars['filter'])) 
74
+        else if ($this->request->getBool($this->vars['filter'])) 
75 75
         {
76 76
             $this->parseSearchTerms($this->request->getParam($this->vars['search']));
77 77
             
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
     
107 107
     protected function getValue(string $filterName) : string
108 108
     {
109
-        if(isset($_SESSION[$this->sessionName][$filterName])) {
109
+        if (isset($_SESSION[$this->sessionName][$filterName])) {
110 110
             return $_SESSION[$this->sessionName][$filterName];
111 111
         }
112 112
         
113 113
         $defaults = $this->getDefaultValues();
114
-        if(isset($defaults[$filterName])) {
114
+        if (isset($defaults[$filterName])) {
115 115
             return $defaults[$filterName];
116 116
         }
117 117
         
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     
131 131
     protected function parseSearchTerms(string $searchString) : void
132 132
     {
133
-        if(empty($searchString)) 
133
+        if (empty($searchString)) 
134 134
         {
135 135
             $this->searchTerms = array();
136 136
             $this->searchString = '';
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
         $terms = array_map('trim', $terms);
145 145
         
146 146
         $keep = array();
147
-        foreach($terms as $term) {
148
-            if(!empty($term)) {
147
+        foreach ($terms as $term) {
148
+            if (!empty($term)) {
149 149
                 $keep[] = $term;
150 150
             }
151 151
         }
@@ -156,28 +156,28 @@  discard block
 block discarded – undo
156 156
     
157 157
     public function isStringMatch(Localization_Scanner_StringHash $string) : bool
158 158
     {
159
-        if(!empty($this->searchTerms)) 
159
+        if (!empty($this->searchTerms)) 
160 160
         {
161 161
             $haystack = $string->getSearchString();
162 162
             
163
-            foreach($this->searchTerms as $term) {
164
-                if(!mb_stristr($haystack, $term)) {
163
+            foreach ($this->searchTerms as $term) {
164
+                if (!mb_stristr($haystack, $term)) {
165 165
                     return false;
166 166
                 }
167 167
             }
168 168
         }
169 169
         
170 170
         $status = $this->getValue($this->vars['status']);
171
-        if($status === 'untranslated' && $string->isTranslated()) {
171
+        if ($status === 'untranslated' && $string->isTranslated()) {
172 172
             return false;
173
-        } else if($status === 'translated' && !$string->isTranslated()) {
173
+        } else if ($status === 'translated' && !$string->isTranslated()) {
174 174
             return false;
175 175
         }
176 176
         
177 177
         $location = $this->getValue($this->vars['location']);
178
-        if($location === 'client' && !$string->hasLanguageType('Javascript')) {
178
+        if ($location === 'client' && !$string->hasLanguageType('Javascript')) {
179 179
             return false;
180
-        } else if($location === 'server' && !$string->hasLanguageType('PHP')) {
180
+        } else if ($location === 'server' && !$string->hasLanguageType('PHP')) {
181 181
             return false;
182 182
         }
183 183
         
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             	<div class="form-hiddens">
206 206
             		<?php 
207 207
     					$params = $this->editor->getRequestParams();
208
-    					foreach($params as $name => $value) {
208
+    					foreach ($params as $name => $value) {
209 209
     					    ?>
210 210
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
211 211
     					    <?php 
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
         ?>
294 294
         	<select class="form-control" name="<?php echo $filterName ?>">
295 295
         		<?php 
296
-                    foreach($entries as $entry) 
296
+                    foreach ($entries as $entry) 
297 297
                     {
298 298
                         $selected = '';
299
-                        if($entry['value'] === $value) {
299
+                        if ($entry['value'] === $value) {
300 300
                             $selected = ' selected';
301 301
                         }
302 302
                         
Please login to merge, or discard this patch.
src/Localization/Editor.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 namespace AppLocalize;
13 13
 
14
-use AppLocalize\Editor\OutputBuffering;use AppUtils\ConvertHelper;
14
+use AppLocalize\Editor\OutputBuffering; use AppUtils\ConvertHelper;
15 15
 use AppUtils\PaginationHelper;
16 16
 use AppUtils\Traits_Optionable;
17 17
 use AppUtils\Interface_Optionable;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public function __construct()
100 100
     {
101 101
         $path = realpath(__DIR__.'/../');
102
-        if($path === false)
102
+        if ($path === false)
103 103
         {
104 104
             throw new Localization_Exception(
105 105
                 'Local path not found',
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
     
153 153
     protected function initSession() : void
154 154
     {
155
-        if(session_status() != PHP_SESSION_ACTIVE) {
155
+        if (session_status() != PHP_SESSION_ACTIVE) {
156 156
             session_start();
157 157
         }
158 158
         
159
-        if(!isset($_SESSION['localization_messages'])) {
159
+        if (!isset($_SESSION['localization_messages'])) {
160 160
             $_SESSION['localization_messages'] = array();
161 161
         }
162 162
     }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     {
174 174
         $this->sources = Localization::getSources();
175 175
         
176
-        if(empty($this->sources)) 
176
+        if (empty($this->sources)) 
177 177
         {
178 178
             throw new Localization_Exception(
179 179
                 'Cannot start editor: no sources defined.',
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         }
184 184
         
185 185
         $activeID = $this->request->registerParam($this->getVarName('source'))->setEnum(Localization::getSourceIDs())->get();
186
-        if(empty($activeID)) {
186
+        if (empty($activeID)) {
187 187
             $activeID = $this->getDefaultSourceID();
188 188
         }
189 189
         
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     protected function getDefaultSourceID() : string
194 194
     {
195 195
         $default = $this->getOption('default-source');
196
-        if(!empty($default) && Localization::sourceAliasExists($default)) {
196
+        if (!empty($default) && Localization::sourceAliasExists($default)) {
197 197
             return Localization::getSourceByAlias($default)->getID();
198 198
         }
199 199
         
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
         $names = array();
206 206
         
207 207
         $locales = Localization::getAppLocales();
208
-        foreach($locales as $locale) {
209
-            if(!$locale->isNative()) {
208
+        foreach ($locales as $locale) {
209
+            if (!$locale->isNative()) {
210 210
                 $this->appLocales[] = $locale;
211 211
                 $names[] = $locale->getName();
212 212
             }
213 213
         }
214 214
         
215 215
         // use the default locale if no other is available.
216
-        if(empty($names)) {
216
+        if (empty($names)) {
217 217
             $this->activeAppLocale = Localization::getAppLocale();
218 218
             return;
219 219
         }
220 220
        
221 221
         $activeID = $this->request->registerParam($this->getVarName('locale'))->setEnum($names)->get();
222
-        if(empty($activeID)) {
222
+        if (empty($activeID)) {
223 223
             $activeID = $this->appLocales[0]->getName();
224 224
         }
225 225
         
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
         
235 235
         $this->filters = new Localization_Editor_Filters($this);
236 236
         
237
-        if($this->request->getBool($this->getVarName('scan'))) 
237
+        if ($this->request->getBool($this->getVarName('scan'))) 
238 238
         {
239 239
             $this->executeScan();
240 240
         } 
241
-        else if($this->request->getBool($this->getVarName('save'))) 
241
+        else if ($this->request->getBool($this->getVarName('save'))) 
242 242
         {
243 243
             $this->executeSave();
244 244
         }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             </button>
286 286
             <div class="collapse navbar-collapse" id="navbarsExampleDefault">
287 287
                 <?php 
288
-                    if(!empty($this->appLocales))
288
+                    if (!empty($this->appLocales))
289 289
                     {
290 290
                         ?>
291 291
                             <ul class="navbar-nav mr-auto">
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
                                 	</a>
296 296
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
297 297
                                     	<?php 
298
-                                    	    foreach($this->sources as $source)
298
+                                    	    foreach ($this->sources as $source)
299 299
                                     	    {
300 300
                                     	       ?>
301 301
                                         			<a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>">
302 302
                                         				<?php 
303
-                                            				if($source->getID() === $this->activeSource->getID()) 
303
+                                            				if ($source->getID() === $this->activeSource->getID()) 
304 304
                                             				{
305 305
                                             				    ?>
306 306
                                             				    	<b><?php echo $source->getLabel() ?></b>
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                                         				?>
314 314
                                         				<?php
315 315
                                         				    $untranslated = $source->countUntranslated($this->scanner);
316
-                                        				    if($untranslated > 0) {
316
+                                        				    if ($untranslated > 0) {
317 317
                                         				        ?>
318 318
                                         				        	(<span class="text-danger" title="<?php ptex('%1$s texts have not been translated in this text source.', 'Amount of texts', $untranslated) ?>"><?php echo $untranslated ?></span>)
319 319
                                 				            	<?php 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                                 	</a>
332 332
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
333 333
                                     	<?php 
334
-                                    	    foreach($this->appLocales as $locale)
334
+                                    	    foreach ($this->appLocales as $locale)
335 335
                                     	    {
336 336
                                     	       ?>
337 337
                                         			<a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>">
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                                     </a>
350 350
                     			</li>
351 351
                     			<?php 
352
-                        			if($this->scanner->hasWarnings()) {
352
+                        			if ($this->scanner->hasWarnings()) {
353 353
                         			    ?>
354 354
                         			    	<li class="nav-item">
355 355
                         			    		<a href="<?php echo $this->getWarningsURL() ?>">
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 ?>
369 369
                 <?php 
370 370
                     $backURL = $this->getOption('back-url');
371
-                    if(!empty($backURL)) 
371
+                    if (!empty($backURL)) 
372 372
                     {
373 373
                         ?>
374 374
                             <a href="<?php echo $backURL ?>" class="btn btn-light btn-sm">
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		<main role="main" class="container">
384 384
 			<div>
385 385
     			<?php 
386
-    			    if(empty($this->appLocales))
386
+    			    if (empty($this->appLocales))
387 387
     			    {
388 388
     			        ?>
389 389
     			        	<div class="alert alert-danger">
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     			        	</div>
394 394
     			        <?php 
395 395
     			    }
396
-    			    else if($this->request->getBool($this->getVarName('warnings')))
396
+    			    else if ($this->request->getBool($this->getVarName('warnings')))
397 397
     			    {
398 398
     			        echo $this->renderWarnings();
399 399
     			    }
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
     			        ?>
403 403
             				<h1><?php echo $this->activeSource->getLabel() ?></h1>
404 404
             				<?php 
405
-                				if(!empty($_SESSION['localization_messages'])) 
405
+                				if (!empty($_SESSION['localization_messages'])) 
406 406
                 				{
407
-                				    foreach($_SESSION['localization_messages'] as $def)
407
+                				    foreach ($_SESSION['localization_messages'] as $def)
408 408
                 				    {
409 409
                 				        ?>
410 410
                 				        	<div class="alert alert-<?php echo $def['type'] ?>" role="alert">
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             				</p>
434 434
             				<br>
435 435
             				<?php
436
-                				if(!$this->scanner->isScanAvailable()) 
436
+                				if (!$this->scanner->isScanAvailable()) 
437 437
                 				{
438 438
                 				    ?>
439 439
                 				    	<div class="alert alert-primary" role="alert">
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
         		<?php 
481 481
         		    $warnings = $this->scanner->getWarnings();
482 482
         		    
483
-        		    foreach($warnings as $warning)
483
+        		    foreach ($warnings as $warning)
484 484
         		    {
485 485
         		        ?>
486 486
         		        	<dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt>
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
         
505 505
         $result = array();
506 506
         
507
-        foreach($strings as $string)
507
+        foreach ($strings as $string)
508 508
         {
509
-            if($this->filters->isStringMatch($string)) {
509
+            if ($this->filters->isStringMatch($string)) {
510 510
                 $result[] = $string;
511 511
             }
512 512
         }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     {
538 538
         $strings = $this->getFilteredStrings();
539 539
         
540
-        if(empty($strings))
540
+        if (empty($strings))
541 541
         {
542 542
             ?>
543 543
             	<div class="alert alert-info">
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 				<div class="form-hiddens">
560 560
 					<?php 
561 561
     					$params = $this->getRequestParams();
562
-    					foreach($params as $name => $value) {
562
+    					foreach ($params as $name => $value) {
563 563
     					    ?>
564 564
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
565 565
     					    <?php 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
     				</thead>
578 578
     				<tbody>
579 579
     					<?php 
580
-    					    foreach($keep as $string)
580
+    					    foreach ($keep as $string)
581 581
     					    {
582 582
     					        $this->renderListEntry($string);
583 583
     					    }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
     				</tbody>
586 586
     			</table>
587 587
     			<?php 
588
-        			if($pager->hasPages()) 
588
+        			if ($pager->hasPages()) 
589 589
         			{
590 590
         			    $prevUrl = $this->getPaginationURL($pager->getPreviousPage());
591 591
         			    $nextUrl = $this->getPaginationURL($pager->getNextPage());
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
                             		</li>
601 601
                             		<?php 
602 602
                             		    $numbers = $pager->getPageNumbers();
603
-                            		    foreach($numbers as $number) 
603
+                            		    foreach ($numbers as $number) 
604 604
                             		    {
605 605
                             		        $url = $this->getPaginationURL($number);
606 606
                             		        
607 607
                             		        ?>
608
-                            		        	<li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>">
608
+                            		        	<li class="page-item <?php if ($pager->isCurrentPage($number)) { echo 'active'; } ?>">
609 609
                             		        		<a class="page-link" href="<?php echo $url ?>">
610 610
                             		        			<?php echo $number ?>
611 611
                         		        			</a>
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
         <?php 
636 636
     }
637 637
     
638
-    protected function getPaginationURL(int $page, array $params=array()) : string
638
+    protected function getPaginationURL(int $page, array $params = array()) : string
639 639
     {
640 640
         $params[$this->getVarName('page')] = $page;
641 641
         
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
         $text = $string->getText();
649 649
         
650 650
         $previewText = $string->getTranslatedText();
651
-        if(empty($previewText)) {
651
+        if (empty($previewText)) {
652 652
             $previewText = $text->getText();
653 653
         }
654 654
         
655
-        $shortText =  $this->renderText($previewText, 50);
655
+        $shortText = $this->renderText($previewText, 50);
656 656
         
657 657
         $files = $string->getFiles();
658 658
         
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
         			</p>
673 673
                     <?php
674 674
                         $explanation = $text->getExplanation();
675
-                        if(!empty($explanation))
675
+                        if (!empty($explanation))
676 676
                         {
677 677
                             ?>
678 678
                             <p>
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
             				<?php 
696 696
             				    $totalFiles = count($files);
697 697
             				    
698
-            				    if($totalFiles == 1)
698
+            				    if ($totalFiles == 1)
699 699
             				    {
700 700
             				        pt('Found in a single file:');
701 701
             				    }
@@ -710,16 +710,16 @@  discard block
 block discarded – undo
710 710
                 				<?php 
711 711
                 				    $locations = $string->getStrings();
712 712
                 				    
713
-                    				foreach($locations as $location) 
713
+                    				foreach ($locations as $location) 
714 714
                     				{
715 715
                     				    $file = $location->getSourceFile();
716 716
                     				    $line = $location->getLine();
717 717
                     				    
718 718
                     				    $ext = FileHelper::getExtension($file);
719 719
                     				    
720
-                    				    if($ext == 'php') {
720
+                    				    if ($ext == 'php') {
721 721
                     				        $icon = 'fab fa-php';
722
-                    				    } else if($ext == 'js') {
722
+                    				    } else if ($ext == 'js') {
723 723
                     				        $icon = 'fab fa-js-square';
724 724
                     				    } else {
725 725
                     				        $icon = 'fas fa-file-code';
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
         <?php 
742 742
     }
743 743
     
744
-    protected function renderText(string $text, int $cutAt=0) : string
744
+    protected function renderText(string $text, int $cutAt = 0) : string
745 745
     {
746
-        if(empty($text)) {
746
+        if (empty($text)) {
747 747
             return '';
748 748
         }
749 749
 
750
-        if($cutAt > 0) {
750
+        if ($cutAt > 0) {
751 751
             $text = ConvertHelper::text_cut($text, $cutAt);
752 752
         }
753 753
 
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         
756 756
         $vars = $this->detectVariables($text);
757 757
         
758
-        foreach($vars as $var) {
758
+        foreach ($vars as $var) {
759 759
             $text = str_replace($var, '<span class="placeholder">'.$var.'</span>', $text);
760 760
         }
761 761
         
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
         $result = array();
768 768
         preg_match_all('/%[0-9]+d|%s|%[0-9]+\$s/i', $string, $result, PREG_PATTERN_ORDER);
769 769
 
770
-        if(isset($result[0]) && !empty($result[0])) {
770
+        if (isset($result[0]) && !empty($result[0])) {
771 771
             return $result[0];
772 772
         }
773 773
         
@@ -783,10 +783,10 @@  discard block
 block discarded – undo
783 783
         
784 784
         // add a counter of the additional files if the total
785 785
         // is higher than the maximum to show
786
-        if($total > $max) 
786
+        if ($total > $max) 
787 787
         {
788 788
             $length = $max;
789
-            if($length > $keepTotal) {
789
+            if ($length > $keepTotal) {
790 790
                 $length = $keepTotal; 
791 791
             }
792 792
             
@@ -814,14 +814,14 @@  discard block
 block discarded – undo
814 814
         return FileHelper::readContents($this->installPath.'/css/editor.css');
815 815
     }
816 816
     
817
-    public function getSourceURL(Localization_Source $source, array $params=array()) : string
817
+    public function getSourceURL(Localization_Source $source, array $params = array()) : string
818 818
     {
819 819
         $params[$this->getVarName('source')] = $source->getID();
820 820
         
821 821
         return $this->getURL($params);
822 822
     }
823 823
     
824
-    public function getLocaleURL(Localization_Locale $locale, array $params=array()) : string
824
+    public function getLocaleURL(Localization_Locale $locale, array $params = array()) : string
825 825
     {
826 826
         $params[$this->getVarName('locale')] = $locale->getName();
827 827
         
@@ -838,12 +838,12 @@  discard block
 block discarded – undo
838 838
         return $this->getSourceURL($this->activeSource, array($this->getVarName('warnings') => 'yes'));
839 839
     }
840 840
     
841
-    public function getURL(array $params=array()) : string
841
+    public function getURL(array $params = array()) : string
842 842
     {
843 843
         $persist = $this->getRequestParams();
844 844
         
845
-        foreach($persist as $name => $value) {
846
-            if(!isset($params[$name])) {
845
+        foreach ($persist as $name => $value) {
846
+            if (!isset($params[$name])) {
847 847
                 $params[$name] = $value;
848 848
             }
849 849
         }
@@ -880,11 +880,11 @@  discard block
 block discarded – undo
880 880
         $translator = Localization::getTranslator($this->activeAppLocale);
881 881
         
882 882
         $strings = $data[$this->getVarName('strings')];
883
-        foreach($strings as $hash => $text) 
883
+        foreach ($strings as $hash => $text) 
884 884
         {
885 885
             $text = trim($text);
886 886
             
887
-            if(empty($text)) {
887
+            if (empty($text)) {
888 888
                 continue;
889 889
             } 
890 890
             
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
     
907 907
     protected function renderStatus(Localization_Scanner_StringHash $hash) : string
908 908
     {
909
-        if($hash->isTranslated()) {
909
+        if ($hash->isTranslated()) {
910 910
             return '<i class="fa fa-check text-success"></i>';
911 911
         }        
912 912
         
@@ -917,18 +917,18 @@  discard block
 block discarded – undo
917 917
     {
918 918
         $types = array();
919 919
         
920
-        if($hash->hasLanguageType('PHP')) {
920
+        if ($hash->hasLanguageType('PHP')) {
921 921
             $types[] = t('Server');
922 922
         }
923 923
         
924
-        if($hash->hasLanguageType('Javascript')) {
924
+        if ($hash->hasLanguageType('Javascript')) {
925 925
             $types[] = t('Client');
926 926
         }
927 927
         
928 928
         return implode(', ', $types);
929 929
     }
930 930
     
931
-    protected function addMessage(string $message, string $type=self::MESSAGE_INFO) : void
931
+    protected function addMessage(string $message, string $type = self::MESSAGE_INFO) : void
932 932
     {
933 933
         $_SESSION['localization_messages'][] = array(
934 934
             'text' => $message,
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
     public function getAppName() : string
966 966
     {
967 967
         $name = $this->getOption('appname');
968
-        if(!empty($name)) {
968
+        if (!empty($name)) {
969 969
             return $name;
970 970
         }
971 971
         
Please login to merge, or discard this patch.
src/Localization.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     */
120 120
     public static function init() : void
121 121
     {
122
-        if(self::$initDone) {
122
+        if (self::$initDone) {
123 123
             return;
124 124
         }
125 125
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     */
164 164
     public static function getLocalesByNS(string $namespace)
165 165
     {
166
-        if(isset(self::$locales[$namespace])) {
166
+        if (isset(self::$locales[$namespace])) {
167 167
             return array_values(self::$locales[$namespace]);
168 168
         }
169 169
         
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
     */
209 209
     public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale
210 210
     {
211
-        if(!isset(self::$locales[$namespace])) {
211
+        if (!isset(self::$locales[$namespace])) {
212 212
             self::$locales[$namespace] = array();
213 213
         }
214 214
         
215
-        if(!isset(self::$locales[$namespace][$localeName])) 
215
+        if (!isset(self::$locales[$namespace][$localeName])) 
216 216
         {
217 217
             self::$locales[$namespace][$localeName] = self::createLocale($localeName);
218 218
             
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
      */
275 275
     public static function createCountry(string $id) : Localization_Country
276 276
     {
277
-        $className = Localization_Country::class.'_' . strtoupper($id);
277
+        $className = Localization_Country::class.'_'.strtoupper($id);
278 278
 
279 279
         $country = new $className();
280 280
 
281
-        if($country instanceof Localization_Country)
281
+        if ($country instanceof Localization_Country)
282 282
         {
283 283
             return $country;
284 284
         }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     {
387 387
         self::requireNamespace($namespace);
388 388
         
389
-        if(isset(self::$selected[$namespace])) {
389
+        if (isset(self::$selected[$namespace])) {
390 390
             return self::$selected[$namespace];
391 391
         }
392 392
         
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
         $locale = self::addLocaleByNS($localeName, $namespace);
426 426
         $previous = null;
427 427
         
428
-        if(isset(self::$selected[$namespace])) 
428
+        if (isset(self::$selected[$namespace])) 
429 429
         {
430
-            if(self::$selected[$namespace]->getName() === $localeName) {
430
+            if (self::$selected[$namespace]->getName() === $localeName) {
431 431
                 return $locale;
432 432
             }
433 433
             
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
         $class = Localization_Event::class.'_'.$name;
464 464
         $event = new $class($argsList);
465 465
         
466
-        if(!isset(self::$listeners[$name])) {
466
+        if (!isset(self::$listeners[$name])) {
467 467
             return $event;
468 468
         }
469 469
         
470
-        foreach(self::$listeners[$name] as $listener) 
470
+        foreach (self::$listeners[$name] as $listener) 
471 471
         {
472 472
             $callArgs = $listener['args'];
473 473
             array_unshift($callArgs, $event);
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
      * @throws Localization_Exception
490 490
      * @see Localization::ERROR_UNKNOWN_EVENT_NAME
491 491
      */
492
-    public static function addEventListener(string $eventName, $callback, array $args=array()) : int
492
+    public static function addEventListener(string $eventName, $callback, array $args = array()) : int
493 493
     {
494
-        if(!isset(self::$listeners[$eventName])) {
494
+        if (!isset(self::$listeners[$eventName])) {
495 495
             self::$listeners[$eventName] = array();
496 496
         }
497 497
         
498 498
         $className = Localization_Event::class.'_'.$eventName;
499 499
         
500
-        if(!class_exists($className)) 
500
+        if (!class_exists($className)) 
501 501
         {
502 502
             throw new Localization_Exception(
503 503
                 sprintf('Unknown localization event [%s].', $eventName),
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
      * @throws Localization_Exception
532 532
      * @see Localization_Event_LocaleChanged
533 533
      */
534
-    public static function onLocaleChanged($callback, array $args=array()) : int
534
+    public static function onLocaleChanged($callback, array $args = array()) : int
535 535
     {
536 536
         return self::addEventListener(self::EVENT_LOCALE_CHANGED, $callback, $args);
537 537
     }
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
     {
659 659
         self::requireNamespace($namespace);
660 660
         
661
-        if(isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) {
661
+        if (isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) {
662 662
             return self::$locales[$namespace][$localeName];
663 663
         }
664 664
         
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
      * @param Localization_Locale|null $locale
738 738
      * @return Localization_Translator
739 739
      */
740
-    public static function getTranslator(?Localization_Locale $locale=null) : Localization_Translator
740
+    public static function getTranslator(?Localization_Locale $locale = null) : Localization_Translator
741 741
     {
742
-        if($locale !== null)
742
+        if ($locale !== null)
743 743
         {
744 744
             $obj = new Localization_Translator();
745 745
             $obj->addSources(self::getSources());
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
             return $obj;
748 748
         }
749 749
             
750
-        if(!isset(self::$translator)) 
750
+        if (!isset(self::$translator)) 
751 751
         {
752 752
             $obj = new Localization_Translator();
753 753
             $obj->addSources(self::getSources());
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
     {
773 773
         self::requireNamespace($namespace);
774 774
         
775
-        if(isset(self::$locales[$namespace])) {
775
+        if (isset(self::$locales[$namespace])) {
776 776
             return count(self::$locales[$namespace]);
777 777
         }
778 778
         
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
      */
786 786
     protected static function requireNamespace(string $namespace) : void
787 787
     {
788
-        if(isset(self::$locales[$namespace])) {
788
+        if (isset(self::$locales[$namespace])) {
789 789
             return;
790 790
         }
791 791
         
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
     * @param string $label
809 809
     * @return HTML_QuickForm2_Element_Select
810 810
     */
811
-    public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
811
+    public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
812 812
     {
813 813
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label);
814 814
     }
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
     * @param string $label
823 823
     * @return HTML_QuickForm2_Element_Select
824 824
     */
825
-    public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
825
+    public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
826 826
     {
827 827
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label);
828 828
     }
@@ -839,9 +839,9 @@  discard block
 block discarded – undo
839 839
      * @return HTML_QuickForm2_Element_Select
840 840
      * @throws Localization_Exception
841 841
      */
842
-    public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
842
+    public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
843 843
     {
844
-        if(empty($label)) {
844
+        if (empty($label)) {
845 845
             $label = t('Language');
846 846
         }
847 847
 
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 
851 851
         $locales = self::getLocalesByNS($namespace);
852 852
         
853
-        foreach($locales as $locale) {
853
+        foreach ($locales as $locale) {
854 854
             $select->addOption($locale->getLabel(), $locale->getName());
855 855
         }
856 856
 
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
     
885 885
     public static function addExcludeFolder(string $folderName) : void
886 886
     { 
887
-        if(!in_array($folderName, self::$excludeFolders)) {
887
+        if (!in_array($folderName, self::$excludeFolders)) {
888 888
             self::$excludeFolders[] = $folderName;
889 889
         }
890 890
     }
891 891
     
892 892
     public static function addExcludeFile(string $fileName) : void
893 893
     {
894
-        if(!in_array($fileName, self::$excludeFiles)) {
894
+        if (!in_array($fileName, self::$excludeFiles)) {
895 895
             self::$excludeFiles[] = $fileName;
896 896
         }
897 897
     }
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
         
919 919
         $grouped = array();
920 920
         
921
-        foreach($sources as $source) 
921
+        foreach ($sources as $source) 
922 922
         {
923 923
             $group = $source->getGroup();
924 924
             
925
-            if(!isset($grouped[$group])) {
925
+            if (!isset($grouped[$group])) {
926 926
                 $grouped[$group] = array();
927 927
             }
928 928
             
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
     public static function sourceExists(string $sourceID) : bool
941 941
     {
942 942
         $sources = self::getSources();
943
-        foreach($sources as $source) {
944
-            if($source->getID() == $sourceID) {
943
+        foreach ($sources as $source) {
944
+            if ($source->getID() == $sourceID) {
945 945
                 return true;
946 946
             }
947 947
         }
@@ -957,8 +957,8 @@  discard block
 block discarded – undo
957 957
     public static function sourceAliasExists(string $sourceAlias) : bool
958 958
     {
959 959
         $sources = self::getSources();
960
-        foreach($sources as $source) {
961
-            if($source->getAlias() == $sourceAlias) {
960
+        foreach ($sources as $source) {
961
+            if ($source->getAlias() == $sourceAlias) {
962 962
                 return true;
963 963
             }
964 964
         }
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
     public static function getSourceByID(string $sourceID) : Localization_Source
977 977
     {
978 978
         $sources = self::getSources();
979
-        foreach($sources as $source) {
980
-            if($source->getID() == $sourceID) {
979
+        foreach ($sources as $source) {
980
+            if ($source->getID() == $sourceID) {
981 981
                 return $source;
982 982
             }
983 983
         }
@@ -1002,8 +1002,8 @@  discard block
 block discarded – undo
1002 1002
     public static function getSourceByAlias(string $sourceAlias) : Localization_Source
1003 1003
     {
1004 1004
         $sources = self::getSources();
1005
-        foreach($sources as $source) {
1006
-            if($source->getAlias() == $sourceAlias) {
1005
+        foreach ($sources as $source) {
1006
+            if ($source->getAlias() == $sourceAlias) {
1007 1007
                 return $source;
1008 1008
             }
1009 1009
         }
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
      * @throws FileHelper_Exception
1048 1048
      * @throws Localization_Exception
1049 1049
      */
1050
-    public static function configure(string $storageFile, string $clientLibrariesFolder='') : void
1050
+    public static function configure(string $storageFile, string $clientLibrariesFolder = '') : void
1051 1051
     {
1052 1052
         self::$configured = true;
1053 1053
         
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
         // only write the client libraries to disk if the folder
1058 1058
         // has been specified.
1059
-        if(!empty($clientLibrariesFolder)) 
1059
+        if (!empty($clientLibrariesFolder)) 
1060 1060
         {
1061 1061
             self::writeClientFiles();
1062 1062
         }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
      * @throws Localization_Exception|FileHelper_Exception
1115 1115
      * @see Localization_ClientGenerator
1116 1116
      */
1117
-    public static function writeClientFiles(bool $force=false) : void
1117
+    public static function writeClientFiles(bool $force = false) : void
1118 1118
     {
1119 1119
         self::createGenerator()->writeFiles($force);
1120 1120
     }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
      */
1148 1148
     protected static function requireConfiguration() : void
1149 1149
     {
1150
-        if(!self::$configured) 
1150
+        if (!self::$configured) 
1151 1151
         {
1152 1152
             throw new Localization_Exception(
1153 1153
                 'The localization configuration is incomplete.',
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
             );
1157 1157
         }
1158 1158
 
1159
-        if(empty(self::$storageFile))
1159
+        if (empty(self::$storageFile))
1160 1160
         {
1161 1161
             throw new Localization_Exception(
1162 1162
                 'No localization storage file set',
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
             );
1166 1166
         }
1167 1167
         
1168
-        if(empty(self::$sources)) 
1168
+        if (empty(self::$sources)) 
1169 1169
         {
1170 1170
             throw new Localization_Exception(
1171 1171
                 'No source folders have been defined.',
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
     {
1199 1199
         $ids = array();
1200 1200
         
1201
-        foreach(self::$sources as $source) {
1201
+        foreach (self::$sources as $source) {
1202 1202
             $ids[] = $source->getID();
1203 1203
         }
1204 1204
         
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
     {
1214 1214
         $aliases = array();
1215 1215
         
1216
-        foreach(self::$sources as $source) {
1216
+        foreach (self::$sources as $source) {
1217 1217
             $aliases[] = $source->getAlias();
1218 1218
         }
1219 1219
         
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
      */
1252 1252
     public static function getSupportedLocaleNames() : array
1253 1253
     {
1254
-        if(empty(self::$supportedLocales))
1254
+        if (empty(self::$supportedLocales))
1255 1255
         {
1256 1256
             self::$supportedLocales = FileHelper::createFileFinder(__DIR__.'/Localization/Locale')
1257 1257
                 ->getPHPClassNames();
Please login to merge, or discard this patch.
src/Localization/Locale.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
      */
138 138
     public function getCountry() : Localization_Country
139 139
     {
140
-        if(!isset($this->country)) {
140
+        if (!isset($this->country)) {
141 141
             $this->country = Localization::createCountry($this->countryCode);
142 142
         }
143 143
         
Please login to merge, or discard this patch.
src/Localization/Parser/Language.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     */
98 98
     public function getID() : string
99 99
     {
100
-        if(!isset($this->id)) {
100
+        if (!isset($this->id)) {
101 101
             $this->id = str_replace(Localization_Parser_Language::class.'_', '', get_class($this));
102 102
         }
103 103
         
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     */
123 123
     public function parseFile(string $path) : void
124 124
     {
125
-        if(!file_exists($path)) 
125
+        if (!file_exists($path)) 
126 126
         {
127 127
             throw new Localization_Exception(
128 128
                 sprintf('Source code file [%s] not found', basename($path)),
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
         $this->tokens = $this->getTokens();
176 176
         $this->totalTokens = count($this->tokens);
177 177
         
178
-        for($i = 0; $i < $this->totalTokens; $i++)
178
+        for ($i = 0; $i < $this->totalTokens; $i++)
179 179
         {
180 180
             $token = $this->createToken($this->tokens[$i]);
181 181
             
182
-            if($token->isTranslationFunction()) {
183
-                $this->parseToken($i+1, $token);
182
+            if ($token->isTranslationFunction()) {
183
+                $this->parseToken($i + 1, $token);
184 184
             }
185 185
         }
186 186
     }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         return self::$allowedContextTags;
205 205
     }
206 206
 
207
-    protected function addResult(string $text, int $line=0, string $explanation='') : void
207
+    protected function addResult(string $text, int $line = 0, string $explanation = '') : void
208 208
     {
209 209
         $this->log(sprintf('Line [%1$s] | Found string [%2$s]', $line, $text));
210 210
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     * @param Localization_Parser_Token|NULL $parentToken
274 274
     * @return Localization_Parser_Token
275 275
     */
276
-    protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token
276
+    protected function createToken($definition, Localization_Parser_Token $parentToken = null) : Localization_Parser_Token
277 277
     {
278 278
         $class = Localization_Parser_Token::class.'_'.$this->getID();
279 279
         
@@ -293,48 +293,48 @@  discard block
 block discarded – undo
293 293
         $open = false;
294 294
         $explanation = '';
295 295
         
296
-        for($i = $number; $i < $max; $i++)
296
+        for ($i = $number; $i < $max; $i++)
297 297
         {
298
-            if(!isset($this->tokens[$i])) {
298
+            if (!isset($this->tokens[$i])) {
299 299
                 break;
300 300
             }
301 301
             
302 302
             $subToken = $this->createToken($this->tokens[$i], $token);
303 303
             
304
-            if(!$open && $subToken->isOpeningFuncParams())
304
+            if (!$open && $subToken->isOpeningFuncParams())
305 305
             {
306 306
                 $open = true;
307 307
                 continue;
308 308
             }
309 309
             
310
-            if($open && $subToken->isClosingFuncParams()) {
310
+            if ($open && $subToken->isClosingFuncParams()) {
311 311
                 break;
312 312
             }
313 313
             
314 314
             // additional parameters in the translation function, we don't want to capture these now.
315
-            if($open && $subToken->isArgumentSeparator())
315
+            if ($open && $subToken->isArgumentSeparator())
316 316
             {
317
-                if($token->isExplanationFunction()) {
318
-                    $leftover = array_slice($this->tokens, $i+1);
317
+                if ($token->isExplanationFunction()) {
318
+                    $leftover = array_slice($this->tokens, $i + 1);
319 319
                     $explanation = $this->parseExplanation($token, $leftover);
320 320
                 }
321 321
                 break;
322 322
             }
323 323
             
324
-            if($open && $subToken->isEncapsedString())
324
+            if ($open && $subToken->isEncapsedString())
325 325
             {
326 326
                 $textParts[] = $this->trimText(strval($subToken->getValue()));
327 327
                 continue;
328 328
             }
329 329
             
330
-            if($open && $subToken->isVariableOrFunction()) {
330
+            if ($open && $subToken->isVariableOrFunction()) {
331 331
                 $textParts = null;
332 332
                 $this->addWarning($subToken, t('Variables or functions are not supported in translation functions.'));
333 333
                 break;
334 334
             }
335 335
         }
336 336
         
337
-        if(empty($textParts)) {
337
+        if (empty($textParts)) {
338 338
             return;
339 339
         }
340 340
         
@@ -348,38 +348,38 @@  discard block
 block discarded – undo
348 348
         $textParts = array();
349 349
         $max = 200;
350 350
 
351
-        for($i = 0; $i < $max; $i++)
351
+        for ($i = 0; $i < $max; $i++)
352 352
         {
353
-            if(!isset($tokens[$i])) {
353
+            if (!isset($tokens[$i])) {
354 354
                 break;
355 355
             }
356 356
 
357 357
             $subToken = $this->createToken($tokens[$i], $token);
358 358
 
359
-            if($subToken->isClosingFuncParams()) {
359
+            if ($subToken->isClosingFuncParams()) {
360 360
                 break;
361 361
             }
362 362
 
363 363
             // additional parameters in the translation function, we don't want to capture these now.
364
-            if($subToken->isArgumentSeparator())
364
+            if ($subToken->isArgumentSeparator())
365 365
             {
366 366
                 break;
367 367
             }
368 368
 
369
-            if($subToken->isEncapsedString())
369
+            if ($subToken->isEncapsedString())
370 370
             {
371 371
                 $textParts[] = $this->trimText(strval($subToken->getValue()));
372 372
                 continue;
373 373
             }
374 374
 
375
-            if($subToken->isVariableOrFunction()) {
375
+            if ($subToken->isVariableOrFunction()) {
376 376
                 $textParts = null;
377 377
                 $this->addWarning($subToken, t('Variables or functions are not supported in translation functions.'));
378 378
                 break;
379 379
             }
380 380
         }
381 381
 
382
-        if(empty($textParts)) {
382
+        if (empty($textParts)) {
383 383
             return '';
384 384
         }
385 385
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
     protected function debug(string $text) : void
390 390
     {
391
-        if($this->debug) {
391
+        if ($this->debug) {
392 392
             echo $text;
393 393
         }
394 394
     }
Please login to merge, or discard this patch.
example/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     $autoload = realpath($root.'/../vendor/autoload.php');
18 18
     
19 19
     // we need the autoloader to be present
20
-    if($autoload === false) {
20
+    if ($autoload === false) {
21 21
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
22 22
     }
23 23
 
Please login to merge, or discard this patch.