@@ -63,11 +63,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'); |
@@ -30,9 +30,9 @@ discard block |
||
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 |
||
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; |
@@ -143,14 +143,14 @@ discard block |
||
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 |
||
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(); |