Passed
Push — master ( df2682...2600cb )
by Sebastian
04:55
created
src/Localization/Translator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function addSources(array $sources) : void
81 81
     {
82
-        foreach($sources as $source) {
82
+        foreach ($sources as $source) {
83 83
             $this->addSource($source);
84 84
         }
85 85
     }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $this->strings[$localeName] = array();
125 125
         }
126 126
 
127
-        foreach($this->sources as $source)
127
+        foreach ($this->sources as $source)
128 128
         {
129 129
             $file = $this->resolveStorageFile($locale, $source);
130 130
             if (!file_exists($file)) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             
134 134
             $data = parse_ini_file($file, false);
135 135
             
136
-            if($data === false) 
136
+            if ($data === false) 
137 137
             {
138 138
                 throw new Localization_Exception(
139 139
                     'Malformatted localization file',
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         
206 206
         $name = $locale->getName();
207 207
         
208
-        if(isset($this->strings[$name])) {
208
+        if (isset($this->strings[$name])) {
209 209
             return $this->strings[$name];
210 210
         }
211 211
         
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
      * @param Localization_Locale $locale
241 241
      * @param boolean $editable
242 242
      */
243
-    protected function renderStringsFile(string $type, Localization_Source $source, array $hashes, string $file, Localization_Locale $locale, bool $editable=true) : void
243
+    protected function renderStringsFile(string $type, Localization_Source $source, array $hashes, string $file, Localization_Locale $locale, bool $editable = true) : void
244 244
     {
245 245
         $writer = new Localization_Writer($locale, $type, $file);
246 246
 
247
-        if($editable)
247
+        if ($editable)
248 248
         {
249 249
             $writer->makeEditable();
250 250
         }
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
         
254 254
         foreach ($hashes as $hash) 
255 255
         {
256
-            if(!$hash->hasSourceID($sourceID)) {
256
+            if (!$hash->hasSourceID($sourceID)) {
257 257
                 continue;
258 258
             }
259 259
             
260 260
             $text = $this->getHashTranslation($hash->getHash(), $locale);
261 261
 
262 262
             // skip any empty strings
263
-            if($text === null || trim($text) == '') {
263
+            if ($text === null || trim($text) == '') {
264 264
                 continue;
265 265
             }
266 266
             
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
     {
339 339
         // to avoid re-creating the hash for the same texts over and over,
340 340
         // we keep track of the hashes we created, and re-use them.
341
-        if(isset($this->reverseStrings[$text])) {
341
+        if (isset($this->reverseStrings[$text])) {
342 342
             $hash = $this->reverseStrings[$text];
343 343
         } else {
344 344
             $hash = md5($text);
@@ -403,15 +403,15 @@  discard block
 block discarded – undo
403 403
      * @param Localization_Locale|null $locale
404 404
      * @return string|NULL
405 405
      */
406
-    public function getHashTranslation(string $hash, ?Localization_Locale $locale=null) : ?string
406
+    public function getHashTranslation(string $hash, ?Localization_Locale $locale = null) : ?string
407 407
     {
408
-        if(!$locale) {
408
+        if (!$locale) {
409 409
             $locale = $this->targetLocale;
410 410
         }
411 411
         
412 412
         $localeName = $locale->getName();
413 413
         
414
-        if(isset($this->strings[$localeName]) && isset($this->strings[$localeName][$hash])) {
414
+        if (isset($this->strings[$localeName]) && isset($this->strings[$localeName][$hash])) {
415 415
             return $this->strings[$localeName][$hash];
416 416
         }
417 417
 
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
     {
430 430
         $result = array();
431 431
         
432
-        foreach($this->sources as $source) 
432
+        foreach ($this->sources as $source) 
433 433
         {
434 434
             $localeFile = self::getClientStorageFile($locale, $source);
435
-            if(!file_exists($localeFile)) {
435
+            if (!file_exists($localeFile)) {
436 436
                 continue;
437 437
             }
438 438
 
Please login to merge, or discard this patch.
src/Localization/Parser/Token.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@
 block discarded – undo
42 42
      * @param array|string $definition
43 43
      * @param Localization_Parser_Token|null $parentToken
44 44
      */
45
-    public function __construct($definition, ?Localization_Parser_Token $parentToken=null)
45
+    public function __construct($definition, ?Localization_Parser_Token $parentToken = null)
46 46
     {
47 47
         $this->definition = $definition;
48 48
         $this->parentToken = $parentToken;
49 49
 
50 50
         $names = $this->getFunctionNames();
51
-        foreach($names as $name) {
51
+        foreach ($names as $name) {
52 52
             $this->nameLookup[$name] = true;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/Localization/Event/LocaleChanged.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function getPrevious() : ?Localization_Locale
32 32
     {
33 33
         $arg = $this->getArgument(1);
34
-        if($arg instanceof Localization_Locale) {
34
+        if ($arg instanceof Localization_Locale) {
35 35
             return $arg;
36 36
         }
37 37
         
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $arg = $this->getArgument(2);
50 50
 
51
-        if($arg instanceof Localization_Locale) {
51
+        if ($arg instanceof Localization_Locale) {
52 52
             return $arg;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/Localization/Scanner.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
     
73 73
     public function scan() : void
74 74
     {
75
-        if(isset($this->collection)) {
75
+        if (isset($this->collection)) {
76 76
             $this->collection = null;
77 77
         }
78 78
         
79 79
         $this->timeStart = microtime(true);
80 80
         
81 81
         $sources = Localization::getSources();
82
-        foreach($sources as $source) 
82
+        foreach ($sources as $source) 
83 83
         {
84 84
             $source->scan($this);
85 85
         }
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function load() : void
93 93
     {
94
-        if(!$this->isScanAvailable()) {
94
+        if (!$this->isScanAvailable()) {
95 95
             return;
96 96
         }
97 97
         
98
-        if($this->loaded) {
98
+        if ($this->loaded) {
99 99
             return;
100 100
         }
101 101
         
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         
104 104
         $data = FileHelper::parseJSONFile($this->storageFile);
105 105
         
106
-        if($this->getCollection()->fromArray($data) === true) {
106
+        if ($this->getCollection()->fromArray($data) === true) {
107 107
             return;
108 108
         }
109 109
         
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     
122 122
     public function getParser() : Localization_Parser
123 123
     {
124
-        if(!isset($this->parser)) {
124
+        if (!isset($this->parser)) {
125 125
             $this->parser = new Localization_Parser($this);
126 126
         }
127 127
         
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     
131 131
     public function getCollection() : Localization_Scanner_StringsCollection
132 132
     {
133
-        if(!isset($this->collection)) {
133
+        if (!isset($this->collection)) {
134 134
             $this->collection = new Localization_Scanner_StringsCollection($this);
135 135
         }
136 136
         
Please login to merge, or discard this patch.
src/Localization/Scanner/StringsCollection.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $hash = $string->getHash();
64 64
         
65
-        if(!isset($this->hashes[$hash])) {
65
+        if (!isset($this->hashes[$hash])) {
66 66
             $this->hashes[$hash] = new Localization_Scanner_StringHash($this, $hash);
67 67
         }
68 68
         
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getHash(string $hash) : Localization_Scanner_StringHash
95 95
     {
96
-        if(isset($this->hashes[$hash])) {
96
+        if (isset($this->hashes[$hash])) {
97 97
             return $this->hashes[$hash];
98 98
         }
99 99
         
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'warnings' => array()
116 116
         );
117 117
         
118
-        foreach($this->hashes as $hash)
118
+        foreach ($this->hashes as $hash)
119 119
         {
120 120
             $data['hashes'] = array_merge($data['hashes'], $hash->toArray());
121 121
         }
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function fromArray(array $array) : bool
133 133
     {
134
-        if(!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) {
134
+        if (!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) {
135 135
             return false;
136 136
         }
137 137
         
138
-        foreach($array['hashes'] as $entry) 
138
+        foreach ($array['hashes'] as $entry) 
139 139
         {
140 140
             $string = Localization_Scanner_StringInfo::fromArray($this, $entry);
141 141
             $this->add($string);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     {
177 177
         $result = array();
178 178
         
179
-        foreach($this->warnings as $def) {
179
+        foreach ($this->warnings as $def) {
180 180
             $result[] = new Localization_Scanner_StringsCollection_Warning($def);
181 181
         }
182 182
         
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function countFiles() : int
192 192
     {
193 193
         $amount = 0;
194
-        foreach($this->hashes as $hash) {
194
+        foreach ($this->hashes as $hash) {
195 195
             $amount = $amount + $hash->countFiles();
196 196
         }
197 197
         
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $hashes = array();
210 210
         
211
-        foreach($this->hashes as $hash) {
212
-            if($hash->hasSourceID($id)) {
211
+        foreach ($this->hashes as $hash) {
212
+            if ($hash->hasSourceID($id)) {
213 213
                 $hashes[] = $hash;
214 214
             }
215 215
         }
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $hashes = array();
229 229
         
230
-        foreach($this->hashes as $hash) {
231
-            if($hash->hasLanguageType($languageID)) {
230
+        foreach ($this->hashes as $hash) {
231
+            if ($hash->hasLanguageType($languageID)) {
232 232
                 $hashes[] = $hash;
233 233
             }
234 234
         }
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/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.
src/Localization/Scanner/StringHash.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $entries = array();
55 55
        
56
-        foreach($this->strings as $string) {
56
+        foreach ($this->strings as $string) {
57 57
             $entries[] = $string->toArray();
58 58
         }
59 59
         
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $amount = 0;
75 75
         
76
-        foreach($this->strings as $string) {
77
-            if($string->isFile()) {
76
+        foreach ($this->strings as $string) {
77
+            if ($string->isFile()) {
78 78
                 $amount++;
79 79
             }
80 80
         }
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
     
90 90
     public function hasLanguageType(string $type) : bool
91 91
     {
92
-        foreach($this->strings as $string) {
93
-            if($string->getLanguageType() == $type) {
92
+        foreach ($this->strings as $string) {
93
+            if ($string->getLanguageType() == $type) {
94 94
                 return true;
95 95
             }
96 96
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     
101 101
     public function getText() : ?Text
102 102
     {
103
-        if(isset($this->strings[0])) {
103
+        if (isset($this->strings[0])) {
104 104
             return $this->strings[0]->getText();
105 105
         }
106 106
         
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $translator = Localization::getTranslator();
133 133
         $text = $translator->getHashTranslation($this->getHash());
134 134
         
135
-        if($text !== null) {
135
+        if ($text !== null) {
136 136
             return $text;
137 137
         }
138 138
         
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $files = array();
149 149
         
150
-        foreach($this->strings as $string) 
150
+        foreach ($this->strings as $string) 
151 151
         {
152
-            if(!$string->isFile()) {
152
+            if (!$string->isFile()) {
153 153
                 continue;
154 154
             }
155 155
             
156 156
             $file = $string->getSourceFile();
157
-            if(!in_array($file, $files)) {
157
+            if (!in_array($file, $files)) {
158 158
                 $files[] = $file;
159 159
             }
160 160
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $files = $this->getFiles();
174 174
         $result = array();
175 175
         
176
-        foreach($files as $path) {
176
+        foreach ($files as $path) {
177 177
             $result[] = basename($path);
178 178
         }
179 179
         
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     {
203 203
         $text = $this->getText();
204 204
 
205
-        if($text !== null)
205
+        if ($text !== null)
206 206
         {
207 207
             return $text->getText();
208 208
         }
Please login to merge, or discard this patch.