Passed
Push — master ( 4a5f5f...d4ccbb )
by Sebastian
03:14
created
src/Localization.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     */
115 115
     public static function init() : void
116 116
     {
117
-        if(self::$initDone) {
117
+        if (self::$initDone) {
118 118
             return;
119 119
         }
120 120
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     */
159 159
     public static function getLocalesByNS(string $namespace)
160 160
     {
161
-        if(isset(self::$locales[$namespace])) {
161
+        if (isset(self::$locales[$namespace])) {
162 162
             return array_values(self::$locales[$namespace]);
163 163
         }
164 164
         
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
     */
204 204
     public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale
205 205
     {
206
-        if(!isset(self::$locales[$namespace])) {
206
+        if (!isset(self::$locales[$namespace])) {
207 207
             self::$locales[$namespace] = array();
208 208
         }
209 209
         
210
-        if(!isset(self::$locales[$namespace][$localeName])) 
210
+        if (!isset(self::$locales[$namespace][$localeName])) 
211 211
         {
212 212
             self::$locales[$namespace][$localeName] = self::createLocale($localeName);
213 213
             
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public static function createCountry(string $id)
240 240
     {
241
-        $className = '\AppLocalize\Localization_Country_' . strtoupper($id);
241
+        $className = '\AppLocalize\Localization_Country_'.strtoupper($id);
242 242
         return new $className();
243 243
     }
244 244
     
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     {
326 326
         self::requireNamespace($namespace);
327 327
         
328
-        if(isset(self::$selected[$namespace])) {
328
+        if (isset(self::$selected[$namespace])) {
329 329
             return self::$selected[$namespace];
330 330
         }
331 331
         
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
         $locale = self::addLocaleByNS($localeName, $namespace);
365 365
         $previous = null;
366 366
         
367
-        if(isset(self::$selected[$namespace])) 
367
+        if (isset(self::$selected[$namespace])) 
368 368
         {
369
-            if(self::$selected[$namespace]->getName() === $localeName) {
369
+            if (self::$selected[$namespace]->getName() === $localeName) {
370 370
                 return $locale;
371 371
             }
372 372
             
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
         $class = Localization_Event::class.'_'.$name;
403 403
         $event = new $class($argsList);
404 404
         
405
-        if(!isset(self::$listeners[$name])) {
405
+        if (!isset(self::$listeners[$name])) {
406 406
             return $event;
407 407
         }
408 408
         
409
-        foreach(self::$listeners[$name] as $listener) 
409
+        foreach (self::$listeners[$name] as $listener) 
410 410
         {
411 411
             $callArgs = $listener['args'];
412 412
             array_unshift($callArgs, $event);
@@ -428,15 +428,15 @@  discard block
 block discarded – undo
428 428
      * @throws Localization_Exception
429 429
      * @see \AppLocalize\Localization::ERROR_UNKNOWN_EVENT_NAME
430 430
      */
431
-    public static function addEventListener(string $eventName, $callback, array $args=array()) : int
431
+    public static function addEventListener(string $eventName, $callback, array $args = array()) : int
432 432
     {
433
-        if(!isset(self::$listeners[$eventName])) {
433
+        if (!isset(self::$listeners[$eventName])) {
434 434
             self::$listeners[$eventName] = array();
435 435
         }
436 436
         
437 437
         $className = Localization_Event::class.'_'.$eventName;
438 438
         
439
-        if(!class_exists($className)) 
439
+        if (!class_exists($className)) 
440 440
         {
441 441
             throw new Localization_Exception(
442 442
                 sprintf('Unknown localization event [%s].', $eventName),
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
      * @throws Localization_Exception
471 471
      * @see Localization_Event_LocaleChanged
472 472
      */
473
-    public static function onLocaleChanged($callback, array $args=array()) : int
473
+    public static function onLocaleChanged($callback, array $args = array()) : int
474 474
     {
475 475
         return self::addEventListener(self::EVENT_LOCALE_CHANGED, $callback, $args);
476 476
     }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     {
598 598
         self::requireNamespace($namespace);
599 599
         
600
-        if(isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) {
600
+        if (isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) {
601 601
             return self::$locales[$namespace][$localeName];
602 602
         }
603 603
         
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
      * @param Localization_Locale|null $locale
677 677
      * @return Localization_Translator
678 678
      */
679
-    public static function getTranslator(?Localization_Locale $locale=null) : Localization_Translator
679
+    public static function getTranslator(?Localization_Locale $locale = null) : Localization_Translator
680 680
     {
681
-        if($locale !== null)
681
+        if ($locale !== null)
682 682
         {
683 683
             $obj = new Localization_Translator();
684 684
             $obj->addSources(self::getSources());
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
             return $obj;
687 687
         }
688 688
             
689
-        if(!isset(self::$translator)) 
689
+        if (!isset(self::$translator)) 
690 690
         {
691 691
             $obj = new Localization_Translator();
692 692
             $obj->addSources(self::getSources());
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
     {
712 712
         self::requireNamespace($namespace);
713 713
         
714
-        if(isset(self::$locales[$namespace])) {
714
+        if (isset(self::$locales[$namespace])) {
715 715
             return count(self::$locales[$namespace]);
716 716
         }
717 717
         
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
      */
725 725
     protected static function requireNamespace(string $namespace) : void
726 726
     {
727
-        if(isset(self::$locales[$namespace])) {
727
+        if (isset(self::$locales[$namespace])) {
728 728
             return;
729 729
         }
730 730
         
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
     * @param string $label
748 748
     * @return HTML_QuickForm2_Element_Select
749 749
     */
750
-    public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
750
+    public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
751 751
     {
752 752
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label);
753 753
     }
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
     * @param string $label
762 762
     * @return HTML_QuickForm2_Element_Select
763 763
     */
764
-    public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
764
+    public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
765 765
     {
766 766
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label);
767 767
     }
@@ -778,9 +778,9 @@  discard block
 block discarded – undo
778 778
      * @return HTML_QuickForm2_Element_Select
779 779
      * @throws Localization_Exception
780 780
      */
781
-    public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
781
+    public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
782 782
     {
783
-        if(empty($label)) {
783
+        if (empty($label)) {
784 784
             $label = t('Language');
785 785
         }
786 786
 
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 
790 790
         $locales = self::getLocalesByNS($namespace);
791 791
         
792
-        foreach($locales as $locale) {
792
+        foreach ($locales as $locale) {
793 793
             $select->addOption($locale->getLabel(), $locale->getName());
794 794
         }
795 795
 
@@ -823,14 +823,14 @@  discard block
 block discarded – undo
823 823
     
824 824
     public static function addExcludeFolder(string $folderName) : void
825 825
     { 
826
-        if(!in_array($folderName, self::$excludeFolders)) {
826
+        if (!in_array($folderName, self::$excludeFolders)) {
827 827
             self::$excludeFolders[] = $folderName;
828 828
         }
829 829
     }
830 830
     
831 831
     public static function addExcludeFile(string $fileName) : void
832 832
     {
833
-        if(!in_array($fileName, self::$excludeFiles)) {
833
+        if (!in_array($fileName, self::$excludeFiles)) {
834 834
             self::$excludeFiles[] = $fileName;
835 835
         }
836 836
     }
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
         
858 858
         $grouped = array();
859 859
         
860
-        foreach($sources as $source) 
860
+        foreach ($sources as $source) 
861 861
         {
862 862
             $group = $source->getGroup();
863 863
             
864
-            if(!isset($grouped[$group])) {
864
+            if (!isset($grouped[$group])) {
865 865
                 $grouped[$group] = array();
866 866
             }
867 867
             
@@ -879,8 +879,8 @@  discard block
 block discarded – undo
879 879
     public static function sourceExists(string $sourceID) : bool
880 880
     {
881 881
         $sources = self::getSources();
882
-        foreach($sources as $source) {
883
-            if($source->getID() == $sourceID) {
882
+        foreach ($sources as $source) {
883
+            if ($source->getID() == $sourceID) {
884 884
                 return true;
885 885
             }
886 886
         }
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
     public static function sourceAliasExists(string $sourceAlias) : bool
897 897
     {
898 898
         $sources = self::getSources();
899
-        foreach($sources as $source) {
900
-            if($source->getAlias() == $sourceAlias) {
899
+        foreach ($sources as $source) {
900
+            if ($source->getAlias() == $sourceAlias) {
901 901
                 return true;
902 902
             }
903 903
         }
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
     public static function getSourceByID(string $sourceID) : Localization_Source
916 916
     {
917 917
         $sources = self::getSources();
918
-        foreach($sources as $source) {
919
-            if($source->getID() == $sourceID) {
918
+        foreach ($sources as $source) {
919
+            if ($source->getID() == $sourceID) {
920 920
                 return $source;
921 921
             }
922 922
         }
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
     public static function getSourceByAlias(string $sourceAlias) : Localization_Source
942 942
     {
943 943
         $sources = self::getSources();
944
-        foreach($sources as $source) {
945
-            if($source->getAlias() == $sourceAlias) {
944
+        foreach ($sources as $source) {
945
+            if ($source->getAlias() == $sourceAlias) {
946 946
                 return $source;
947 947
             }
948 948
         }
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
     * @param string $storageFile Where to store the file analysis storage file.
985 985
     * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created.
986 986
     */
987
-    public static function configure(string $storageFile, string $clientLibrariesFolder='') : void
987
+    public static function configure(string $storageFile, string $clientLibrariesFolder = '') : void
988 988
     {
989 989
         self::$configured = true;
990 990
         
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 
994 994
         // only write the client libraries to disk if the folder
995 995
         // has been specified.
996
-        if(!empty($clientLibrariesFolder)) 
996
+        if (!empty($clientLibrariesFolder)) 
997 997
         {
998 998
             self::writeClientFiles();
999 999
         }
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
      * @throws Localization_Exception
1052 1052
      * @see Localization_ClientGenerator
1053 1053
      */
1054
-    public static function writeClientFiles(bool $force=false) : void
1054
+    public static function writeClientFiles(bool $force = false) : void
1055 1055
     {
1056 1056
         self::createGenerator()->writeFiles($force);
1057 1057
     }
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
      */
1085 1085
     protected static function requireConfiguration() : void
1086 1086
     {
1087
-        if(!self::$configured) 
1087
+        if (!self::$configured) 
1088 1088
         {
1089 1089
             throw new Localization_Exception(
1090 1090
                 'The localization configuration is incomplete.',
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
             );
1094 1094
         }
1095 1095
 
1096
-        if(empty(self::$storageFile))
1096
+        if (empty(self::$storageFile))
1097 1097
         {
1098 1098
             throw new Localization_Exception(
1099 1099
                 'No localization storage file set',
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
             );
1103 1103
         }
1104 1104
         
1105
-        if(empty(self::$sources)) 
1105
+        if (empty(self::$sources)) 
1106 1106
         {
1107 1107
             throw new Localization_Exception(
1108 1108
                 'No source folders have been defined.',
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
     {
1136 1136
         $ids = array();
1137 1137
         
1138
-        foreach(self::$sources as $source) {
1138
+        foreach (self::$sources as $source) {
1139 1139
             $ids[] = $source->getID();
1140 1140
         }
1141 1141
         
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
     {
1151 1151
         $aliases = array();
1152 1152
         
1153
-        foreach(self::$sources as $source) {
1153
+        foreach (self::$sources as $source) {
1154 1154
             $aliases[] = $source->getAlias();
1155 1155
         }
1156 1156
         
Please login to merge, or discard this patch.
src/Localization/Currency/Number.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      */
55 55
     public function getFloat() : float
56 56
     {
57
-        return floatval($this->number . '.' . $this->decimals);
57
+        return floatval($this->number.'.'.$this->decimals);
58 58
     }
59 59
 
60 60
     /**
Please login to merge, or discard this patch.
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/Parser/Language.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     */
83 83
     public function getID() : string
84 84
     {
85
-        if(!isset($this->id)) {
85
+        if (!isset($this->id)) {
86 86
             $this->id = str_replace(Localization_Parser_Language::class.'_', '', get_class($this));
87 87
         }
88 88
         
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     */
108 108
     public function parseFile(string $path) : void
109 109
     {
110
-        if(!file_exists($path)) 
110
+        if (!file_exists($path)) 
111 111
         {
112 112
             throw new Localization_Exception(
113 113
                 sprintf('Source code file [%s] not found', basename($path)),
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
         $this->tokens = $this->getTokens();
161 161
         $this->totalTokens = count($this->tokens);
162 162
         
163
-        for($i = 0; $i < $this->totalTokens; $i++)
163
+        for ($i = 0; $i < $this->totalTokens; $i++)
164 164
         {
165 165
             $token = $this->createToken($this->tokens[$i]);
166 166
             
167
-            if($token->isTranslationFunction()) {
168
-                $this->parseToken($i+1, $token);
167
+            if ($token->isTranslationFunction()) {
168
+                $this->parseToken($i + 1, $token);
169 169
             }
170 170
         }
171 171
     }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         return $this->texts;
179 179
     }
180 180
     
181
-    protected function addResult(string $text, int $line=0, string $explanation='') : void
181
+    protected function addResult(string $text, int $line = 0, string $explanation = '') : void
182 182
     {
183 183
         $this->log(sprintf('Line [%1$s] | Found string [%2$s]', $line, $text));
184 184
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     * @param Localization_Parser_Token|NULL $parentToken
245 245
     * @return Localization_Parser_Token
246 246
     */
247
-    protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token
247
+    protected function createToken($definition, Localization_Parser_Token $parentToken = null) : Localization_Parser_Token
248 248
     {
249 249
         $class = Localization_Parser_Token::class.'_'.$this->getID();
250 250
         
@@ -264,48 +264,48 @@  discard block
 block discarded – undo
264 264
         $open = false;
265 265
         $explanation = '';
266 266
         
267
-        for($i = $number; $i < $max; $i++)
267
+        for ($i = $number; $i < $max; $i++)
268 268
         {
269
-            if(!isset($this->tokens[$i])) {
269
+            if (!isset($this->tokens[$i])) {
270 270
                 break;
271 271
             }
272 272
             
273 273
             $subToken = $this->createToken($this->tokens[$i], $token);
274 274
             
275
-            if(!$open && $subToken->isOpeningFuncParams())
275
+            if (!$open && $subToken->isOpeningFuncParams())
276 276
             {
277 277
                 $open = true;
278 278
                 continue;
279 279
             }
280 280
             
281
-            if($open && $subToken->isClosingFuncParams()) {
281
+            if ($open && $subToken->isClosingFuncParams()) {
282 282
                 break;
283 283
             }
284 284
             
285 285
             // additional parameters in the translation function, we don't want to capture these now.
286
-            if($open && $subToken->isArgumentSeparator())
286
+            if ($open && $subToken->isArgumentSeparator())
287 287
             {
288
-                if($token->isExplanationFunction()) {
289
-                    $leftover = array_slice($this->tokens, $i+1);
288
+                if ($token->isExplanationFunction()) {
289
+                    $leftover = array_slice($this->tokens, $i + 1);
290 290
                     $explanation = $this->parseExplanation($token, $leftover);
291 291
                 }
292 292
                 break;
293 293
             }
294 294
             
295
-            if($open && $subToken->isEncapsedString())
295
+            if ($open && $subToken->isEncapsedString())
296 296
             {
297 297
                 $textParts[] = $this->trimText($subToken->getValue());
298 298
                 continue;
299 299
             }
300 300
             
301
-            if($open && $subToken->isVariableOrFunction()) {
301
+            if ($open && $subToken->isVariableOrFunction()) {
302 302
                 $textParts = null;
303 303
                 $this->addWarning($subToken, t('Variables or functions are not supported in translation functions.'));
304 304
                 break;
305 305
             }
306 306
         }
307 307
         
308
-        if(empty($textParts)) {
308
+        if (empty($textParts)) {
309 309
             return;
310 310
         }
311 311
         
@@ -319,38 +319,38 @@  discard block
 block discarded – undo
319 319
         $textParts = array();
320 320
         $max = 200;
321 321
 
322
-        for($i = 0; $i < $max; $i++)
322
+        for ($i = 0; $i < $max; $i++)
323 323
         {
324
-            if(!isset($tokens[$i])) {
324
+            if (!isset($tokens[$i])) {
325 325
                 break;
326 326
             }
327 327
 
328 328
             $subToken = $this->createToken($tokens[$i], $token);
329 329
 
330
-            if($subToken->isClosingFuncParams()) {
330
+            if ($subToken->isClosingFuncParams()) {
331 331
                 break;
332 332
             }
333 333
 
334 334
             // additional parameters in the translation function, we don't want to capture these now.
335
-            if($subToken->isArgumentSeparator())
335
+            if ($subToken->isArgumentSeparator())
336 336
             {
337 337
                 break;
338 338
             }
339 339
 
340
-            if($subToken->isEncapsedString())
340
+            if ($subToken->isEncapsedString())
341 341
             {
342 342
                 $textParts[] = $this->trimText($subToken->getValue());
343 343
                 continue;
344 344
             }
345 345
 
346
-            if($subToken->isVariableOrFunction()) {
346
+            if ($subToken->isVariableOrFunction()) {
347 347
                 $textParts = null;
348 348
                 $this->addWarning($subToken, t('Variables or functions are not supported in translation functions.'));
349 349
                 break;
350 350
             }
351 351
         }
352 352
 
353
-        if(empty($textParts)) {
353
+        if (empty($textParts)) {
354 354
             return '';
355 355
         }
356 356
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
     protected function debug(string $text) : void
361 361
     {
362
-        if($this->debug) {
362
+        if ($this->debug) {
363 363
             echo $text;
364 364
         }
365 365
     }
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/Currency.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
             return self::$instances[$id];
74 74
         }
75 75
 
76
-        $className = Localization_Currency::class.'_' . $id;
76
+        $className = Localization_Currency::class.'_'.$id;
77 77
 
78 78
         $country = new $className($country);
79 79
 
80
-        if($country instanceof Localization_Currency)
80
+        if ($country instanceof Localization_Currency)
81 81
         {
82 82
             return $country;
83 83
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public static function isCurrencyKnown(string $currencyName) : bool
140 140
     {
141
-        return file_exists(__DIR__ . '/Currency/' . $currencyName . '.php');
141
+        return file_exists(__DIR__.'/Currency/'.$currencyName.'.php');
142 142
     }
143 143
 
144 144
     /**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
      * @return string
351 351
      * @throws Localization_Exception
352 352
      */
353
-    public function makeReadable($number, int $decimalPositions = 2, bool $addSymbol=true) : string
353
+    public function makeReadable($number, int $decimalPositions = 2, bool $addSymbol = true) : string
354 354
     {
355 355
         if ($number === null || $number === '') {
356 356
             return '';
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 
361 361
         $number = $this->formatNumber($parsed->getFloat(), $decimalPositions);
362 362
 
363
-        if(!$addSymbol) {
363
+        if (!$addSymbol) {
364 364
             return $number;
365 365
         }
366 366
         
367 367
         if ($this->isSymbolOnFront()) {
368
-            return $this->getSymbol() . ' ' . $number;
368
+            return $this->getSymbol().' '.$number;
369 369
         }
370 370
 
371
-        return $number . ' ' . $this->getSymbol();
371
+        return $number.' '.$this->getSymbol();
372 372
     }
373 373
 }
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.