Passed
Push — master ( b7fcc1...3c5a70 )
by Sebastian
04:36
created
src/Localization.php 2 patches
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
     public const EVENT_CACHE_KEY_CHANGED = 'CacheKeyChanged';
64 64
 
65 65
     /**
66
-    * Collection of all locales by namespace (application, content, custom...). 
67
-    *
68
-    * @var array<string,array<string,Localization_Locale>>
69
-    * @see Localization::addLocale()
70
-    */
66
+     * Collection of all locales by namespace (application, content, custom...). 
67
+     *
68
+     * @var array<string,array<string,Localization_Locale>>
69
+     * @see Localization::addLocale()
70
+     */
71 71
     protected static $locales = array();
72 72
 
73 73
     /**
@@ -76,57 +76,57 @@  discard block
 block discarded – undo
76 76
      */
77 77
     private static $initDone = false;
78 78
 
79
-   /**
80
-    * Path to the file in which the scanner results are stored.
81
-    * @var string
82
-    * @see Localization::configure()
83
-    */
79
+    /**
80
+     * Path to the file in which the scanner results are stored.
81
+     * @var string
82
+     * @see Localization::configure()
83
+     */
84 84
     protected static $storageFile = '';
85 85
     
86
-   /**
87
-    * Path to the folder into which the client libraries are written.
88
-    * @var string
89
-    * @see Localization::setClientLibrariesFolder()
90
-    */
86
+    /**
87
+     * Path to the folder into which the client libraries are written.
88
+     * @var string
89
+     * @see Localization::setClientLibrariesFolder()
90
+     */
91 91
     protected static $clientFolder = '';
92 92
     
93
-   /**
94
-    * If this key changes, client libraries are refreshed.
95
-    * @var string
96
-    * @see Localization::setClientLibrariesCacheKey()
97
-    */
93
+    /**
94
+     * If this key changes, client libraries are refreshed.
95
+     * @var string
96
+     * @see Localization::setClientLibrariesCacheKey()
97
+     */
98 98
     protected static $clientCacheKey = '';
99 99
     
100
-   /**
101
-    * Whether the configuration has been made.
102
-    * @var bool
103
-    * @see Localization::configure()
104
-    */
100
+    /**
101
+     * Whether the configuration has been made.
102
+     * @var bool
103
+     * @see Localization::configure()
104
+     */
105 105
     protected static $configured = false;
106 106
     
107
-   /**
108
-    * Stores event listener instances.
109
-    * @var array
110
-    */
107
+    /**
108
+     * Stores event listener instances.
109
+     * @var array
110
+     */
111 111
     protected static array $listeners = array();
112 112
     
113
-   /**
114
-    * @var integer
115
-    * @see Localization::addEventListener()
116
-    */
113
+    /**
114
+     * @var integer
115
+     * @see Localization::addEventListener()
116
+     */
117 117
     protected static $listenersCounter = 0;
118 118
     
119
-   /**
120
-    * @var Localization_Translator|NULL
121
-    */
119
+    /**
120
+     * @var Localization_Translator|NULL
121
+     */
122 122
     protected static $translator;
123 123
     
124
-   /**
125
-    * Initializes the localization layer. This is done
126
-    * automatically, and only once per request.
127
-    * 
128
-    * (Called at the end of this file)
129
-    */
124
+    /**
125
+     * Initializes the localization layer. This is done
126
+     * automatically, and only once per request.
127
+     * 
128
+     * (Called at the end of this file)
129
+     */
130 130
     public static function init() : void
131 131
     {
132 132
         if(self::$initDone) {
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         return self::getLocalesByNS(self::NAMESPACE_APPLICATION);
166 166
     }
167 167
     
168
-   /**
169
-    * Retrieves all locales in the specified namespace.
170
-    * 
171
-    * @param string $namespace
172
-    * @return Localization_Locale[]
173
-    */
168
+    /**
169
+     * Retrieves all locales in the specified namespace.
170
+     * 
171
+     * @param string $namespace
172
+     * @return Localization_Locale[]
173
+     */
174 174
     public static function getLocalesByNS(string $namespace)
175 175
     {
176 176
         if(isset(self::$locales[$namespace])) {
@@ -187,35 +187,35 @@  discard block
 block discarded – undo
187 187
         );
188 188
     }
189 189
     
190
-   /**
191
-    * Adds an application locale to use in the application.
192
-    * 
193
-    * @param string $localeName
194
-    * @return Localization_Locale
195
-    */
190
+    /**
191
+     * Adds an application locale to use in the application.
192
+     * 
193
+     * @param string $localeName
194
+     * @return Localization_Locale
195
+     */
196 196
     public static function addAppLocale(string $localeName) : Localization_Locale
197 197
     {
198 198
         return self::addLocaleByNS($localeName, self::NAMESPACE_APPLICATION);
199 199
     }
200 200
     
201
-   /**
202
-    * Adds a content locale to use for content in the application.
203
-    * 
204
-    * @param string $localeName
205
-    * @return Localization_Locale
206
-    */
201
+    /**
202
+     * Adds a content locale to use for content in the application.
203
+     * 
204
+     * @param string $localeName
205
+     * @return Localization_Locale
206
+     */
207 207
     public static function addContentLocale(string $localeName) : Localization_Locale
208 208
     {
209 209
         return self::addLocaleByNS($localeName, self::NAMESPACE_CONTENT);
210 210
     }
211 211
     
212
-   /**
213
-    * Adds a locale to the specified namespace.
214
-    * 
215
-    * @param string $localeName
216
-    * @param string $namespace
217
-    * @return Localization_Locale
218
-    */
212
+    /**
213
+     * Adds a locale to the specified namespace.
214
+     * 
215
+     * @param string $localeName
216
+     * @param string $namespace
217
+     * @return Localization_Locale
218
+     */
219 219
     public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale
220 220
     {
221 221
         if(!isset(self::$locales[$namespace])) {
@@ -368,45 +368,45 @@  discard block
 block discarded – undo
368 368
         return self::getSelectedLocaleByNS(self::NAMESPACE_APPLICATION);
369 369
     }
370 370
     
371
-   /**
372
-    * Retrieves the name of the selected application locale.
373
-    * 
374
-    * @return string
375
-    */
371
+    /**
372
+     * Retrieves the name of the selected application locale.
373
+     * 
374
+     * @return string
375
+     */
376 376
     public static function getAppLocaleName() : string
377 377
     {
378 378
         return self::getLocaleNameByNS(self::NAMESPACE_APPLICATION);
379 379
     }
380 380
     
381
-   /**
382
-    * Retrieves the names of the available application locales.
383
-    * @return string[]
384
-    */
381
+    /**
382
+     * Retrieves the names of the available application locales.
383
+     * @return string[]
384
+     */
385 385
     public static function getAppLocaleNames() : array
386 386
     {
387 387
         return self::getLocaleNamesByNS(self::NAMESPACE_APPLICATION);
388 388
     }
389 389
     
390
-   /**
391
-    * Retrieves the selected locale name in the specified namespace.
392
-    * 
393
-    * @param string $namespace
394
-    * @throws Localization_Exception
395
-    * @return string
396
-    */
390
+    /**
391
+     * Retrieves the selected locale name in the specified namespace.
392
+     * 
393
+     * @param string $namespace
394
+     * @throws Localization_Exception
395
+     * @return string
396
+     */
397 397
     public static function getLocaleNameByNS(string $namespace) : string
398 398
     {
399 399
         return self::getSelectedLocaleByNS($namespace)->getName();
400 400
     }
401 401
     
402
-   /**
403
-    * Retrieves the selected locale instance for the specified namespace.
404
-    * 
405
-    * @param string $namespace
406
-    * @return Localization_Locale
407
-    * @throws Localization_Exception
408
-    * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS
409
-    */
402
+    /**
403
+     * Retrieves the selected locale instance for the specified namespace.
404
+     * 
405
+     * @param string $namespace
406
+     * @return Localization_Locale
407
+     * @throws Localization_Exception
408
+     * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS
409
+     */
410 410
     public static function getSelectedLocaleByNS(string $namespace) : Localization_Locale
411 411
     {
412 412
         self::requireNamespace($namespace);
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
         );
426 426
     }
427 427
     
428
-   /**
429
-    * Stores the selected locale names by namespace.
430
-    * @var array<string,Localization_Locale>
431
-    */
428
+    /**
429
+     * Stores the selected locale names by namespace.
430
+     * @var array<string,Localization_Locale>
431
+     */
432 432
     protected static $selected = array();
433 433
 
434
-   /**
435
-    * Selects the active locale for the specified namespace.
436
-    *
437
-    * NOTE: Triggers the "LocaleChanged" event.
438
-    * 
439
-    * @param string $localeName
440
-    * @param string $namespace
441
-    * @return Localization_Locale
442
-    * @throws Localization_Exception
443
-    *
444
-    * @see LocaleChanged
445
-    */
434
+    /**
435
+     * Selects the active locale for the specified namespace.
436
+     *
437
+     * NOTE: Triggers the "LocaleChanged" event.
438
+     * 
439
+     * @param string $localeName
440
+     * @param string $namespace
441
+     * @return Localization_Locale
442
+     * @throws Localization_Exception
443
+     *
444
+     * @see LocaleChanged
445
+     */
446 446
     public static function selectLocaleByNS(string $localeName, string $namespace) : Localization_Locale
447 447
     {
448 448
         self::requireNamespace($namespace);
@@ -594,15 +594,15 @@  discard block
 block discarded – undo
594 594
         return self::selectLocaleByNS($localeName, self::NAMESPACE_APPLICATION);
595 595
     }
596 596
 
597
-   /**
598
-    * Retrieves an application locale by its name. 
599
-    * Note that the locale must have been added first.
600
-    * 
601
-    * @param string $localeName
602
-    * @throws Localization_Exception
603
-    * @return Localization_Locale
604
-    * @see Localization::appLocaleExists()
605
-    */
597
+    /**
598
+     * Retrieves an application locale by its name. 
599
+     * Note that the locale must have been added first.
600
+     * 
601
+     * @param string $localeName
602
+     * @throws Localization_Exception
603
+     * @return Localization_Locale
604
+     * @see Localization::appLocaleExists()
605
+     */
606 606
     public static function getAppLocaleByName(string $localeName) : Localization_Locale
607 607
     {
608 608
         return self::getLocaleByNameNS($localeName, self::NAMESPACE_APPLICATION);
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
         return self::getLocalesByNS(self::NAMESPACE_CONTENT);
638 638
     }
639 639
     
640
-   /**
641
-    * Retrieves the names of all content locales that have been added.
642
-    * @return string[]
643
-    */
640
+    /**
641
+     * Retrieves the names of all content locales that have been added.
642
+     * @return string[]
643
+     */
644 644
     public static function getContentLocaleNames()
645 645
     {
646 646
         return self::getLocaleNamesByNS(self::NAMESPACE_CONTENT);
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
         sort($names);
664 664
         
665 665
         return $names;
666
-     }
666
+        }
667 667
     
668 668
     /**
669 669
      * Checks by the locale name if the specified locale is
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
         return self::getLocaleByNameNS($localeName, self::NAMESPACE_CONTENT);
693 693
     }
694 694
     
695
-   /**
696
-    * Retrieves a locale by its name in the specified namespace.
697
-    * 
698
-    * @param string $localeName
699
-    * @param string $namespace
700
-    * @throws Localization_Exception
701
-    * @return Localization_Locale
702
-    */
695
+    /**
696
+     * Retrieves a locale by its name in the specified namespace.
697
+     * 
698
+     * @param string $localeName
699
+     * @param string $namespace
700
+     * @throws Localization_Exception
701
+     * @return Localization_Locale
702
+     */
703 703
     public static function getLocaleByNameNS(string $localeName, string $namespace) : Localization_Locale
704 704
     {
705 705
         self::requireNamespace($namespace);
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
         return self::selectLocaleByNS($localeName, self::NAMESPACE_CONTENT);
771 771
     }
772 772
     
773
-   /**
774
-    * Checks whether the localization has been configured entirely.
775
-    * @return bool
776
-    */
773
+    /**
774
+     * Checks whether the localization has been configured entirely.
775
+     * @return bool
776
+     */
777 777
     public static function isConfigured() : bool
778 778
     {
779 779
         return self::$configured;
@@ -845,29 +845,29 @@  discard block
 block discarded – undo
845 845
         );
846 846
     }
847 847
     
848
-   /**
849
-    * Injects a content locales selector element into the specified
850
-    * HTML QuickForm2 container.
851
-    * 
852
-    * @param string $elementName
853
-    * @param HTML_QuickForm2_Container $container
854
-    * @param string $label
855
-    * @return HTML_QuickForm2_Element_Select
856
-    */
848
+    /**
849
+     * Injects a content locales selector element into the specified
850
+     * HTML QuickForm2 container.
851
+     * 
852
+     * @param string $elementName
853
+     * @param HTML_QuickForm2_Container $container
854
+     * @param string $label
855
+     * @return HTML_QuickForm2_Element_Select
856
+     */
857 857
     public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
858 858
     {
859 859
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label);
860 860
     }
861 861
     
862
-   /**
863
-    * Injects an app locales selector element into the specified
862
+    /**
863
+     * Injects an app locales selector element into the specified
864 864
      * HTML QuickForm2 container.
865 865
      * 
866
-    * @param string $elementName
867
-    * @param HTML_QuickForm2_Container $container
868
-    * @param string $label
869
-    * @return HTML_QuickForm2_Element_Select
870
-    */
866
+     * @param string $elementName
867
+     * @param HTML_QuickForm2_Container $container
868
+     * @param string $label
869
+     * @return HTML_QuickForm2_Element_Select
870
+     */
871 871
     public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
872 872
     {
873 873
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label);
@@ -903,26 +903,26 @@  discard block
 block discarded – undo
903 903
         return $select;
904 904
     }
905 905
 
906
-   /**
907
-    * @var Localization_Source[]
908
-    */
906
+    /**
907
+     * @var Localization_Source[]
908
+     */
909 909
     protected static $sources = array();
910 910
     
911
-   /**
912
-    * @var string[]
913
-    */
911
+    /**
912
+     * @var string[]
913
+     */
914 914
     protected static $excludeFolders = array();
915 915
     
916
-   /**
917
-    * @var string[]
918
-    */
916
+    /**
917
+     * @var string[]
918
+     */
919 919
     protected static $excludeFiles = array();
920 920
     
921
-   /**
922
-    * Retrieves all currently available sources.
923
-    * 
924
-    * @return Localization_Source[]
925
-    */
921
+    /**
922
+     * Retrieves all currently available sources.
923
+     * 
924
+     * @return Localization_Source[]
925
+     */
926 926
     public static function getSources() : array
927 927
     {
928 928
         return self::$sources;
@@ -954,10 +954,10 @@  discard block
 block discarded – undo
954 954
         return $source;
955 955
     }
956 956
     
957
-   /**
958
-    * Retrieves all sources grouped by their group name.
959
-    * @return array
960
-    */
957
+    /**
958
+     * Retrieves all sources grouped by their group name.
959
+     * @return array
960
+     */
961 961
     public static function getSourcesGrouped()
962 962
     {
963 963
         $sources = self::getSources();
@@ -978,11 +978,11 @@  discard block
 block discarded – undo
978 978
         return $grouped;
979 979
     }
980 980
     
981
-   /**
982
-    * Checks whether a specific source exists by its ID.
983
-    * @param string $sourceID
984
-    * @return boolean
985
-    */
981
+    /**
982
+     * Checks whether a specific source exists by its ID.
983
+     * @param string $sourceID
984
+     * @return boolean
985
+     */
986 986
     public static function sourceExists(string $sourceID) : bool
987 987
     {
988 988
         $sources = self::getSources();
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
         return false;
996 996
     }
997 997
     
998
-   /**
999
-    * Checks whether a specific source exists by its alias.
1000
-    * @param string $sourceAlias
1001
-    * @return boolean
1002
-    */
998
+    /**
999
+     * Checks whether a specific source exists by its alias.
1000
+     * @param string $sourceAlias
1001
+     * @return boolean
1002
+     */
1003 1003
     public static function sourceAliasExists(string $sourceAlias) : bool
1004 1004
     {
1005 1005
         $sources = self::getSources();
@@ -1012,13 +1012,13 @@  discard block
 block discarded – undo
1012 1012
         return false;
1013 1013
     }
1014 1014
 
1015
-   /**
1016
-    * Retrieves a localization source by its ID.
1017
-    * 
1018
-    * @param string $sourceID
1019
-    * @throws Localization_Exception
1020
-    * @return Localization_Source
1021
-    */
1015
+    /**
1016
+     * Retrieves a localization source by its ID.
1017
+     * 
1018
+     * @param string $sourceID
1019
+     * @throws Localization_Exception
1020
+     * @return Localization_Source
1021
+     */
1022 1022
     public static function getSourceByID(string $sourceID) : Localization_Source
1023 1023
     {
1024 1024
         $sources = self::getSources();
@@ -1108,17 +1108,17 @@  discard block
 block discarded – undo
1108 1108
         }
1109 1109
     }
1110 1110
     
1111
-   /**
1112
-    * Sets a key that is used to verify whether the client
1113
-    * libraries have to be refreshed. A common use is to set
1114
-    * this to the application's version number to guarantee
1115
-    * new texts are automatically used with each release.
1116
-    * 
1117
-    * NOTE: Otherwise files are refreshed only when saving 
1118
-    * them in the editor UI.
1119
-    *  
1120
-    * @param string $key
1121
-    */
1111
+    /**
1112
+     * Sets a key that is used to verify whether the client
1113
+     * libraries have to be refreshed. A common use is to set
1114
+     * this to the application's version number to guarantee
1115
+     * new texts are automatically used with each release.
1116
+     * 
1117
+     * NOTE: Otherwise files are refreshed only when saving 
1118
+     * them in the editor UI.
1119
+     *  
1120
+     * @param string $key
1121
+     */
1122 1122
     public static function setClientLibrariesCacheKey(string $key) : void
1123 1123
     {
1124 1124
         if($key !== self::$clientCacheKey) {
@@ -1132,10 +1132,10 @@  discard block
 block discarded – undo
1132 1132
         return self::$clientCacheKey;
1133 1133
     }
1134 1134
     
1135
-   /**
1136
-    * Sets the folder where client libraries are to be stored.
1137
-    * @param string $folder
1138
-    */
1135
+    /**
1136
+     * Sets the folder where client libraries are to be stored.
1137
+     * @param string $folder
1138
+     */
1139 1139
     public static function setClientLibrariesFolder(string $folder) : void
1140 1140
     {
1141 1141
         if($folder !== self::$clientFolder) {
@@ -1144,14 +1144,14 @@  discard block
 block discarded – undo
1144 1144
         }
1145 1145
     }
1146 1146
     
1147
-   /**
1148
-    * Retrieves the path to the folder in which the client
1149
-    * libraries should be stored.
1150
-    * 
1151
-    * NOTE: Can return an empty string, when this is disabled.
1152
-    * 
1153
-    * @return string
1154
-    */
1147
+    /**
1148
+     * Retrieves the path to the folder in which the client
1149
+     * libraries should be stored.
1150
+     * 
1151
+     * NOTE: Can return an empty string, when this is disabled.
1152
+     * 
1153
+     * @return string
1154
+     */
1155 1155
     public static function getClientLibrariesFolder() : string
1156 1156
     {
1157 1157
         return self::$clientFolder;
@@ -1173,13 +1173,13 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
     private static ?Localization_ClientGenerator $generator = null;
1175 1175
 
1176
-   /**
1177
-    * Creates a new instance of the client generator class
1178
-    * that is used to write the localization files into the
1179
-    * target folder on disk.
1180
-    * 
1181
-    * @return Localization_ClientGenerator
1182
-    */
1176
+    /**
1177
+     * Creates a new instance of the client generator class
1178
+     * that is used to write the localization files into the
1179
+     * target folder on disk.
1180
+     * 
1181
+     * @return Localization_ClientGenerator
1182
+     */
1183 1183
     public static function createGenerator() : Localization_ClientGenerator
1184 1184
     {
1185 1185
         if(!isset(self::$generator)) {
@@ -1248,10 +1248,10 @@  discard block
 block discarded – undo
1248 1248
         return new Localization_Editor();
1249 1249
     }
1250 1250
     
1251
-   /**
1252
-    * Retrieves a list of all available source IDs.
1253
-    * @return string[]
1254
-    */
1251
+    /**
1252
+     * Retrieves a list of all available source IDs.
1253
+     * @return string[]
1254
+     */
1255 1255
     public static function getSourceIDs() : array
1256 1256
     {
1257 1257
         $ids = array();
@@ -1278,9 +1278,9 @@  discard block
 block discarded – undo
1278 1278
         return $aliases;
1279 1279
     }
1280 1280
     
1281
-   /**
1282
-    * Resets all locales to the built-in locale.
1283
-    */
1281
+    /**
1282
+     * Resets all locales to the built-in locale.
1283
+     */
1284 1284
     public static function reset() : void
1285 1285
     {
1286 1286
         self::$locales = array();
@@ -1316,12 +1316,12 @@  discard block
 block discarded – undo
1316 1316
         return self::$supportedLocales;
1317 1317
     }
1318 1318
     
1319
-   /**
1320
-    * Checks whether the specified locale is supported.
1321
-    * 
1322
-    * @param string $localeName
1323
-    * @return bool
1324
-    */
1319
+    /**
1320
+     * Checks whether the specified locale is supported.
1321
+     * 
1322
+     * @param string $localeName
1323
+     * @return bool
1324
+     */
1325 1325
     public static function isLocaleSupported(string $localeName) : bool
1326 1326
     {
1327 1327
         return file_exists(__DIR__.'/Localization/Locale/'.$localeName.'.php');
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     */
130 130
     public static function init() : void
131 131
     {
132
-        if(self::$initDone) {
132
+        if (self::$initDone) {
133 133
             return;
134 134
         }
135 135
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     */
174 174
     public static function getLocalesByNS(string $namespace)
175 175
     {
176
-        if(isset(self::$locales[$namespace])) {
176
+        if (isset(self::$locales[$namespace])) {
177 177
             return array_values(self::$locales[$namespace]);
178 178
         }
179 179
         
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
     */
219 219
     public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale
220 220
     {
221
-        if(!isset(self::$locales[$namespace])) {
221
+        if (!isset(self::$locales[$namespace])) {
222 222
             self::$locales[$namespace] = array();
223 223
         }
224 224
         
225
-        if(!isset(self::$locales[$namespace][$localeName])) 
225
+        if (!isset(self::$locales[$namespace][$localeName])) 
226 226
         {
227 227
             self::$locales[$namespace][$localeName] = self::createLocale($localeName);
228 228
             
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      */
282 282
     public static function createCountries() : CountryCollection
283 283
     {
284
-        if(!isset(self::$countries)) {
284
+        if (!isset(self::$countries)) {
285 285
             self::$countries = CountryCollection::getInstance();
286 286
         }
287 287
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public static function createCurrencies() : CurrencyCollection
300 300
     {
301
-        if(!isset(self::$currencies)) {
301
+        if (!isset(self::$currencies)) {
302 302
             self::$currencies = CurrencyCollection::getInstance();
303 303
         }
304 304
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     {
412 412
         self::requireNamespace($namespace);
413 413
         
414
-        if(isset(self::$selected[$namespace])) {
414
+        if (isset(self::$selected[$namespace])) {
415 415
             return self::$selected[$namespace];
416 416
         }
417 417
         
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
         $locale = self::addLocaleByNS($localeName, $namespace);
451 451
         $previous = null;
452 452
         
453
-        if(isset(self::$selected[$namespace])) 
453
+        if (isset(self::$selected[$namespace])) 
454 454
         {
455
-            if(self::$selected[$namespace]->getName() === $localeName) {
455
+            if (self::$selected[$namespace]->getName() === $localeName) {
456 456
                 return $locale;
457 457
             }
458 458
             
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
             new $class($argsList)
493 493
         );
494 494
         
495
-        if(!isset(self::$listeners[$name])) {
495
+        if (!isset(self::$listeners[$name])) {
496 496
             return $event;
497 497
         }
498 498
         
499
-        foreach(self::$listeners[$name] as $listener) 
499
+        foreach (self::$listeners[$name] as $listener) 
500 500
         {
501 501
             $callArgs = $listener['args'];
502 502
             array_unshift($callArgs, $event);
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
      * @throws Localization_Exception
519 519
      * @see Localization::ERROR_UNKNOWN_EVENT_NAME
520 520
      */
521
-    public static function addEventListener(string $eventName, $callback, array $args=array()) : int
521
+    public static function addEventListener(string $eventName, $callback, array $args = array()) : int
522 522
     {
523
-        if(!isset(self::$listeners[$eventName])) {
523
+        if (!isset(self::$listeners[$eventName])) {
524 524
             self::$listeners[$eventName] = array();
525 525
         }
526 526
         
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             'AppLocalize'
544 544
         );
545 545
 
546
-        if(class_exists($className)) {
546
+        if (class_exists($className)) {
547 547
             return $className;
548 548
         }
549 549
 
@@ -567,17 +567,17 @@  discard block
 block discarded – undo
567 567
      * @throws Localization_Exception
568 568
      * @see LocaleChanged
569 569
      */
570
-    public static function onLocaleChanged($callback, array $args=array()) : int
570
+    public static function onLocaleChanged($callback, array $args = array()) : int
571 571
     {
572 572
         return self::addEventListener(self::EVENT_LOCALE_CHANGED, $callback, $args);
573 573
     }
574 574
 
575
-    public static function onClientFolderChanged(callable $callback, array $args=array()) : int
575
+    public static function onClientFolderChanged(callable $callback, array $args = array()) : int
576 576
     {
577 577
         return self::addEventListener(self::EVENT_CLIENT_FOLDER_CHANGED, $callback, $args);
578 578
     }
579 579
 
580
-    public static function onCacheKeyChanged(callable $callback, array $args=array()) : int
580
+    public static function onCacheKeyChanged(callable $callback, array $args = array()) : int
581 581
     {
582 582
         return self::addEventListener(self::EVENT_CACHE_KEY_CHANGED, $callback, $args);
583 583
     }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
     {
705 705
         self::requireNamespace($namespace);
706 706
         
707
-        if(isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) {
707
+        if (isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) {
708 708
             return self::$locales[$namespace][$localeName];
709 709
         }
710 710
         
@@ -783,9 +783,9 @@  discard block
 block discarded – undo
783 783
      * @param Localization_Locale|null $locale
784 784
      * @return Localization_Translator
785 785
      */
786
-    public static function getTranslator(?Localization_Locale $locale=null) : Localization_Translator
786
+    public static function getTranslator(?Localization_Locale $locale = null) : Localization_Translator
787 787
     {
788
-        if($locale !== null)
788
+        if ($locale !== null)
789 789
         {
790 790
             $obj = new Localization_Translator();
791 791
             $obj->addSources(self::getSources());
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
             return $obj;
794 794
         }
795 795
             
796
-        if(!isset(self::$translator)) 
796
+        if (!isset(self::$translator)) 
797 797
         {
798 798
             $obj = new Localization_Translator();
799 799
             $obj->addSources(self::getSources());
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
     {
819 819
         self::requireNamespace($namespace);
820 820
         
821
-        if(isset(self::$locales[$namespace])) {
821
+        if (isset(self::$locales[$namespace])) {
822 822
             return count(self::$locales[$namespace]);
823 823
         }
824 824
         
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
      */
832 832
     protected static function requireNamespace(string $namespace) : void
833 833
     {
834
-        if(isset(self::$locales[$namespace])) {
834
+        if (isset(self::$locales[$namespace])) {
835 835
             return;
836 836
         }
837 837
         
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
     * @param string $label
855 855
     * @return HTML_QuickForm2_Element_Select
856 856
     */
857
-    public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
857
+    public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
858 858
     {
859 859
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label);
860 860
     }
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
     * @param string $label
869 869
     * @return HTML_QuickForm2_Element_Select
870 870
     */
871
-    public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
871
+    public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
872 872
     {
873 873
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label);
874 874
     }
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
      * @return HTML_QuickForm2_Element_Select
886 886
      * @throws Localization_Exception
887 887
      */
888
-    public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
888
+    public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select
889 889
     {
890
-        if(empty($label)) {
890
+        if (empty($label)) {
891 891
             $label = t('Language');
892 892
         }
893 893
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 
897 897
         $locales = self::getLocalesByNS($namespace);
898 898
         
899
-        foreach($locales as $locale) {
899
+        foreach ($locales as $locale) {
900 900
             $select->addOption($locale->getLabel(), $locale->getName());
901 901
         }
902 902
 
@@ -930,14 +930,14 @@  discard block
 block discarded – undo
930 930
     
931 931
     public static function addExcludeFolder(string $folderName) : void
932 932
     { 
933
-        if(!in_array($folderName, self::$excludeFolders)) {
933
+        if (!in_array($folderName, self::$excludeFolders)) {
934 934
             self::$excludeFolders[] = $folderName;
935 935
         }
936 936
     }
937 937
     
938 938
     public static function addExcludeFile(string $fileName) : void
939 939
     {
940
-        if(!in_array($fileName, self::$excludeFiles)) {
940
+        if (!in_array($fileName, self::$excludeFiles)) {
941 941
             self::$excludeFiles[] = $fileName;
942 942
         }
943 943
     }
@@ -964,11 +964,11 @@  discard block
 block discarded – undo
964 964
         
965 965
         $grouped = array();
966 966
         
967
-        foreach($sources as $source) 
967
+        foreach ($sources as $source) 
968 968
         {
969 969
             $group = $source->getGroup();
970 970
             
971
-            if(!isset($grouped[$group])) {
971
+            if (!isset($grouped[$group])) {
972 972
                 $grouped[$group] = array();
973 973
             }
974 974
             
@@ -986,8 +986,8 @@  discard block
 block discarded – undo
986 986
     public static function sourceExists(string $sourceID) : bool
987 987
     {
988 988
         $sources = self::getSources();
989
-        foreach($sources as $source) {
990
-            if($source->getID() == $sourceID) {
989
+        foreach ($sources as $source) {
990
+            if ($source->getID() == $sourceID) {
991 991
                 return true;
992 992
             }
993 993
         }
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
     public static function sourceAliasExists(string $sourceAlias) : bool
1004 1004
     {
1005 1005
         $sources = self::getSources();
1006
-        foreach($sources as $source) {
1007
-            if($source->getAlias() == $sourceAlias) {
1006
+        foreach ($sources as $source) {
1007
+            if ($source->getAlias() == $sourceAlias) {
1008 1008
                 return true;
1009 1009
             }
1010 1010
         }
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
     public static function getSourceByID(string $sourceID) : Localization_Source
1023 1023
     {
1024 1024
         $sources = self::getSources();
1025
-        foreach($sources as $source) {
1026
-            if($source->getID() == $sourceID) {
1025
+        foreach ($sources as $source) {
1026
+            if ($source->getID() == $sourceID) {
1027 1027
                 return $source;
1028 1028
             }
1029 1029
         }
@@ -1048,8 +1048,8 @@  discard block
 block discarded – undo
1048 1048
     public static function getSourceByAlias(string $sourceAlias) : Localization_Source
1049 1049
     {
1050 1050
         $sources = self::getSources();
1051
-        foreach($sources as $source) {
1052
-            if($source->getAlias() == $sourceAlias) {
1051
+        foreach ($sources as $source) {
1052
+            if ($source->getAlias() == $sourceAlias) {
1053 1053
                 return $source;
1054 1054
             }
1055 1055
         }
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
      * @throws FileHelper_Exception
1094 1094
      * @throws Localization_Exception
1095 1095
      */
1096
-    public static function configure(string $storageFile, string $clientLibrariesFolder='') : void
1096
+    public static function configure(string $storageFile, string $clientLibrariesFolder = '') : void
1097 1097
     {
1098 1098
         self::$configured = true;
1099 1099
         
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
         // only write the client libraries to disk if the folder
1104 1104
         // has been specified.
1105
-        if(!empty($clientLibrariesFolder)) 
1105
+        if (!empty($clientLibrariesFolder)) 
1106 1106
         {
1107 1107
             self::writeClientFiles();
1108 1108
         }
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
     */
1122 1122
     public static function setClientLibrariesCacheKey(string $key) : void
1123 1123
     {
1124
-        if($key !== self::$clientCacheKey) {
1124
+        if ($key !== self::$clientCacheKey) {
1125 1125
             self::$clientCacheKey = $key;
1126 1126
             self::triggerEvent(self::EVENT_CACHE_KEY_CHANGED, array($key));
1127 1127
         }
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
     */
1139 1139
     public static function setClientLibrariesFolder(string $folder) : void
1140 1140
     {
1141
-        if($folder !== self::$clientFolder) {
1141
+        if ($folder !== self::$clientFolder) {
1142 1142
             self::$clientFolder = $folder;
1143 1143
             self::triggerEvent(self::EVENT_CLIENT_FOLDER_CHANGED, array($folder));
1144 1144
         }
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
      * @throws Localization_Exception|FileHelper_Exception
1167 1167
      * @see Localization_ClientGenerator
1168 1168
      */
1169
-    public static function writeClientFiles(bool $force=false) : void
1169
+    public static function writeClientFiles(bool $force = false) : void
1170 1170
     {
1171 1171
         self::createGenerator()->writeFiles();
1172 1172
     }
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
     */
1183 1183
     public static function createGenerator() : Localization_ClientGenerator
1184 1184
     {
1185
-        if(!isset(self::$generator)) {
1185
+        if (!isset(self::$generator)) {
1186 1186
             self::$generator = new Localization_ClientGenerator();
1187 1187
         }
1188 1188
 
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
      */
1206 1206
     protected static function requireConfiguration() : void
1207 1207
     {
1208
-        if(!self::$configured) 
1208
+        if (!self::$configured) 
1209 1209
         {
1210 1210
             throw new Localization_Exception(
1211 1211
                 'The localization configuration is incomplete.',
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
             );
1215 1215
         }
1216 1216
 
1217
-        if(empty(self::$storageFile))
1217
+        if (empty(self::$storageFile))
1218 1218
         {
1219 1219
             throw new Localization_Exception(
1220 1220
                 'No localization storage file set',
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
             );
1224 1224
         }
1225 1225
         
1226
-        if(empty(self::$sources)) 
1226
+        if (empty(self::$sources)) 
1227 1227
         {
1228 1228
             throw new Localization_Exception(
1229 1229
                 'No source folders have been defined.',
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
     {
1257 1257
         $ids = array();
1258 1258
         
1259
-        foreach(self::$sources as $source) {
1259
+        foreach (self::$sources as $source) {
1260 1260
             $ids[] = $source->getID();
1261 1261
         }
1262 1262
         
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
     {
1272 1272
         $aliases = array();
1273 1273
         
1274
-        foreach(self::$sources as $source) {
1274
+        foreach (self::$sources as $source) {
1275 1275
             $aliases[] = $source->getAlias();
1276 1276
         }
1277 1277
         
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
      */
1308 1308
     public static function getSupportedLocaleNames() : array
1309 1309
     {
1310
-        if(empty(self::$supportedLocales))
1310
+        if (empty(self::$supportedLocales))
1311 1311
         {
1312 1312
             self::$supportedLocales = FileHelper::createFileFinder(__DIR__.'/Localization/Locale')
1313 1313
                 ->getPHPClassNames();
@@ -1331,13 +1331,13 @@  discard block
 block discarded – undo
1331 1331
 
1332 1332
     public static function getVersion() : string
1333 1333
     {
1334
-        if(isset(self::$version)) {
1334
+        if (isset(self::$version)) {
1335 1335
             return self::$version;
1336 1336
         }
1337 1337
 
1338 1338
         $versionFile = FileInfo::factory(__DIR__.'/../version.txt');
1339 1339
 
1340
-        if($versionFile->exists()) {
1340
+        if ($versionFile->exists()) {
1341 1341
             self::$version = $versionFile->getContents();
1342 1342
             return self::$version;
1343 1343
         }
Please login to merge, or discard this patch.
src/Localization/Event/LocaleChanged.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
     public const ERROR_NO_CURRENT_LOCALE_SPECIFIED = 91401;
31 31
 
32 32
     /**
33
-    * The locale that was used before the change, if any.
34
-    * @return Localization_Locale|NULL
35
-    */
33
+     * The locale that was used before the change, if any.
34
+     * @return Localization_Locale|NULL
35
+     */
36 36
     public function getPrevious() : ?Localization_Locale
37 37
     {
38 38
         $arg = $this->getArgument(1);
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
         );
65 65
     }
66 66
     
67
-   /**
68
-    * The namespace in which the locale change occurred.
69
-    * @return string
70
-    */
67
+    /**
68
+     * The namespace in which the locale change occurred.
69
+     * @return string
70
+     */
71 71
     public function getNamespace() : string
72 72
     {
73 73
         return strval($this->getArgument(0));
74 74
     }
75 75
 
76
-   /**
77
-    * Whether the change occurred for an application locale.
78
-    * @return bool
79
-    */
76
+    /**
77
+     * Whether the change occurred for an application locale.
78
+     * @return bool
79
+     */
80 80
     public function isAppLocale() : bool
81 81
     {
82 82
         return $this->getNamespace() === Localization::NAMESPACE_APPLICATION;
83 83
     }
84 84
     
85
-   /**
86
-    * Whether the change occurred for a content locale.
87
-    * @return bool
88
-    */
85
+    /**
86
+     * Whether the change occurred for a content locale.
87
+     * @return bool
88
+     */
89 89
     public function isContentLocale() : bool
90 90
     {
91 91
         return $this->getNamespace() === Localization::NAMESPACE_CONTENT;
Please login to merge, or discard this patch.
src/Localization/Generator.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
         $this->writeCacheKey();
144 144
     }
145 145
     
146
-   /**
147
-    * Retrieves a list of all localization client 
148
-    * files that are written to disk. This includes
149
-    * the locale files and the libraries required
150
-    * to make it work clientside.
151
-    * 
152
-    * @return string[]
153
-    */
146
+    /**
147
+     * Retrieves a list of all localization client 
148
+     * files that are written to disk. This includes
149
+     * the locale files and the libraries required
150
+     * to make it work clientside.
151
+     * 
152
+     * @return string[]
153
+     */
154 154
     public function getFilesList() : array
155 155
     {
156 156
         $files = array();
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
         return self::$systemKey;
329 329
     }
330 330
 
331
-   /**
332
-    * Generates the cache key file, which is used to determine
333
-    * automatically whether the client libraries need to be 
334
-    * refreshed.
335
-    */
331
+    /**
332
+     * Generates the cache key file, which is used to determine
333
+     * automatically whether the client libraries need to be 
334
+     * refreshed.
335
+     */
336 336
     protected function writeCacheKey() : void
337 337
     {
338 338
         $this->cacheKey = self::getSystemKey();
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $this->translator = Localization::getTranslator();
26 26
 
27
-        Localization::onLocaleChanged(function () {
27
+        Localization::onLocaleChanged(function() {
28 28
             $this->handleLocaleChanged();
29 29
         });
30 30
 
31
-        Localization::onCacheKeyChanged(function () {
31
+        Localization::onCacheKeyChanged(function() {
32 32
             $this->handleCacheKeyChanged();
33 33
         });
34 34
 
35
-        Localization::onClientFolderChanged(function () {
35
+        Localization::onClientFolderChanged(function() {
36 36
             $this->handleFolderChanged();
37 37
         });
38 38
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $folder = Localization::getClientFolder();
43 43
 
44
-        if(!empty($folder)) {
44
+        if (!empty($folder)) {
45 45
             return FolderInfo::factory($folder);
46 46
         }
47 47
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $folder = $this->getTargetFolder();
54 54
 
55
-        if($folder !== null) {
55
+        if ($folder !== null) {
56 56
             return FileInfo::factory($folder.'/cachekey.txt');
57 57
         }
58 58
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
     private static function log(string $message, ...$args) : void
93 93
     {
94
-        if(self::$logging === false) {
94
+        if (self::$logging === false) {
95 95
             return;
96 96
         }
97 97
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 
101 101
     public function getCacheKey() : ?string
102 102
     {
103
-        if(isset($this->cacheKey)) {
103
+        if (isset($this->cacheKey)) {
104 104
             return $this->cacheKey;
105 105
         }
106 106
 
107 107
         $file = $this->getCacheKeyFile();
108 108
 
109
-        if($file !== null && $file->exists()) {
109
+        if ($file !== null && $file->exists()) {
110 110
             $this->cacheKey = $file->getContents();
111 111
         }
112 112
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         self::log('Write Files');
123 123
 
124
-        if($this->getCacheKey() === self::getSystemKey()) {
124
+        if ($this->getCacheKey() === self::getSystemKey()) {
125 125
             self::log('Write Files | SKIP | Still up to date.');
126 126
             return;
127 127
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $targetFolder = $this->getTargetFolder();
130 130
 
131 131
         // no client libraries folder set: ignore.
132
-        if($targetFolder === null) {
132
+        if ($targetFolder === null) {
133 133
             self::log('Write Files | SKIP | No folder set.');
134 134
             return;
135 135
         }
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $files = array();
157 157
         
158
-        foreach($this->libraries as $fileName)
158
+        foreach ($this->libraries as $fileName)
159 159
         {
160 160
             $files[] = $this->getLibraryFilePath($fileName);
161 161
         }
162 162
         
163
-        foreach($this->getTargetLocales() as $locale)
163
+        foreach ($this->getTargetLocales() as $locale)
164 164
         {
165 165
             $files[] = $this->getLocaleFilePath($locale);
166 166
         }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     {
173 173
         self::log('Write Files | Writing locales.');
174 174
 
175
-        foreach(self::getTargetLocales() as $locale)
175
+        foreach (self::getTargetLocales() as $locale)
176 176
         {
177 177
             $this->writeLocaleFile($locale);
178 178
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     {
195 195
         $sourceFolder = FolderInfo::factory(__DIR__.'/../js');
196 196
 
197
-        if(!$sourceFolder->exists())
197
+        if (!$sourceFolder->exists())
198 198
         {
199 199
             throw new Localization_Exception(
200 200
                 'Unexpected folder structure encountered.',
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             );
207 207
         }
208 208
         
209
-        foreach($this->libraries as $fileName)
209
+        foreach ($this->libraries as $fileName)
210 210
         {
211 211
             $targetFile = $this->getLibraryFilePath($fileName);
212 212
             $sourceFile = $sourceFolder.'/'.$fileName;
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $result = array();
224 224
 
225
-        foreach(Localization::getAppLocales() as $locale) {
226
-            if($locale->isNative()) {
225
+        foreach (Localization::getAppLocales() as $locale) {
226
+            if ($locale->isNative()) {
227 227
                 continue;
228 228
             }
229 229
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     {
238 238
         $result = array();
239 239
 
240
-        foreach(self::getTargetLocales() as $locale) {
240
+        foreach (self::getTargetLocales() as $locale) {
241 241
             $result[] = $locale->getName();
242 242
         }
243 243
 
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
         $strings = $this->translator->getClientStrings($locale);
282 282
         
283 283
         $tokens = array();
284
-        foreach($strings as $hash => $text)
284
+        foreach ($strings as $hash => $text)
285 285
         {
286
-            if(empty($text)) {
286
+            if (empty($text)) {
287 287
                 continue;
288 288
             }
289 289
             
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             );
295 295
         }
296 296
         
297
-        if(empty($tokens))
297
+        if (empty($tokens))
298 298
         {
299 299
             $content = '/* No strings found. */';
300 300
         }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
     public static function getSystemKey() : string
316 316
     {
317
-        if(!isset(self::$systemKey)) {
317
+        if (!isset(self::$systemKey)) {
318 318
             self::$systemKey = sprintf(
319 319
                 'Lib:%s|System:%s|Locales:%s',
320 320
                 Localization::getClientLibrariesCacheKey(),
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
         $file = $this->getCacheKeyFile();
341 341
 
342
-        if($file !== null) {
342
+        if ($file !== null) {
343 343
             $file->putContents($this->cacheKey);
344 344
         }
345 345
 
Please login to merge, or discard this patch.