@@ -129,7 +129,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -24,15 +24,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |