Test Failed
Push — master ( 824d3b...82b8bb )
by Sebastian
03:28
created
src/Localization.php 1 patch
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
     const EVENT_LOCALE_CHANGED = 'LocaleChanged';
54 54
 
55 55
     /**
56
-    * Collection of all locales by namespace (application, content, custom...). 
57
-    *
58
-    * @var array<string,array<string,Localization_Locale>>
59
-    * @see Localization::addLocale()
60
-    */
56
+     * Collection of all locales by namespace (application, content, custom...). 
57
+     *
58
+     * @var array<string,array<string,Localization_Locale>>
59
+     * @see Localization::addLocale()
60
+     */
61 61
     protected static $locales = array();
62 62
 
63 63
     /**
@@ -66,57 +66,57 @@  discard block
 block discarded – undo
66 66
      */
67 67
     private static $initDone = false;
68 68
 
69
-   /**
70
-    * Path to the file in which the scanner results are stored.
71
-    * @var string
72
-    * @see Localization::configure()
73
-    */
69
+    /**
70
+     * Path to the file in which the scanner results are stored.
71
+     * @var string
72
+     * @see Localization::configure()
73
+     */
74 74
     protected static $storageFile = '';
75 75
     
76
-   /**
77
-    * Path to the folder into which the client libraries are written.
78
-    * @var string
79
-    * @see Localization::setClientLibrariesFolder()
80
-    */
76
+    /**
77
+     * Path to the folder into which the client libraries are written.
78
+     * @var string
79
+     * @see Localization::setClientLibrariesFolder()
80
+     */
81 81
     protected static $clientFolder = '';
82 82
     
83
-   /**
84
-    * If this key changes, client libraries are refreshed.
85
-    * @var string
86
-    * @see Localization::setClientLibrariesCacheKey()
87
-    */
83
+    /**
84
+     * If this key changes, client libraries are refreshed.
85
+     * @var string
86
+     * @see Localization::setClientLibrariesCacheKey()
87
+     */
88 88
     protected static $clientCacheKey = '';
89 89
     
90
-   /**
91
-    * Whether the configuration has been made.
92
-    * @var bool
93
-    * @see Localization::configure()
94
-    */
90
+    /**
91
+     * Whether the configuration has been made.
92
+     * @var bool
93
+     * @see Localization::configure()
94
+     */
95 95
     protected static $configured = false;
96 96
     
97
-   /**
98
-    * Stores event listener instances.
99
-    * @var array
100
-    */
97
+    /**
98
+     * Stores event listener instances.
99
+     * @var array
100
+     */
101 101
     protected static $listeners = array();
102 102
     
103
-   /**
104
-    * @var integer
105
-    * @see Localization::addEventListener()
106
-    */
103
+    /**
104
+     * @var integer
105
+     * @see Localization::addEventListener()
106
+     */
107 107
     protected static $listenersCounter = 0;
108 108
     
109
-   /**
110
-    * @var Localization_Translator|NULL
111
-    */
109
+    /**
110
+     * @var Localization_Translator|NULL
111
+     */
112 112
     protected static $translator;
113 113
     
114
-   /**
115
-    * Initializes the localization layer. This is done
116
-    * automatically, and only once per request.
117
-    * 
118
-    * (Called at the end of this file)
119
-    */
114
+    /**
115
+     * Initializes the localization layer. This is done
116
+     * automatically, and only once per request.
117
+     * 
118
+     * (Called at the end of this file)
119
+     */
120 120
     public static function init() : void
121 121
     {
122 122
         if(self::$initDone) {
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
         return self::getLocalesByNS(self::NAMESPACE_APPLICATION);
156 156
     }
157 157
     
158
-   /**
159
-    * Retrieves all locales in the specified namespace.
160
-    * 
161
-    * @param string $namespace
162
-    * @return Localization_Locale[]
163
-    */
158
+    /**
159
+     * Retrieves all locales in the specified namespace.
160
+     * 
161
+     * @param string $namespace
162
+     * @return Localization_Locale[]
163
+     */
164 164
     public static function getLocalesByNS(string $namespace)
165 165
     {
166 166
         if(isset(self::$locales[$namespace])) {
@@ -177,35 +177,35 @@  discard block
 block discarded – undo
177 177
         );
178 178
     }
179 179
     
180
-   /**
181
-    * Adds an application locale to use in the application.
182
-    * 
183
-    * @param string $localeName
184
-    * @return Localization_Locale
185
-    */
180
+    /**
181
+     * Adds an application locale to use in the application.
182
+     * 
183
+     * @param string $localeName
184
+     * @return Localization_Locale
185
+     */
186 186
     public static function addAppLocale(string $localeName) : Localization_Locale
187 187
     {
188 188
         return self::addLocaleByNS($localeName, self::NAMESPACE_APPLICATION);
189 189
     }
190 190
     
191
-   /**
192
-    * Adds a content locale to use for content in the application.
193
-    * 
194
-    * @param string $localeName
195
-    * @return Localization_Locale
196
-    */
191
+    /**
192
+     * Adds a content locale to use for content in the application.
193
+     * 
194
+     * @param string $localeName
195
+     * @return Localization_Locale
196
+     */
197 197
     public static function addContentLocale(string $localeName) : Localization_Locale
198 198
     {
199 199
         return self::addLocaleByNS($localeName, self::NAMESPACE_CONTENT);
200 200
     }
201 201
     
202
-   /**
203
-    * Adds a locale to the specified namespace.
204
-    * 
205
-    * @param string $localeName
206
-    * @param string $namespace
207
-    * @return Localization_Locale
208
-    */
202
+    /**
203
+     * Adds a locale to the specified namespace.
204
+     * 
205
+     * @param string $localeName
206
+     * @param string $namespace
207
+     * @return Localization_Locale
208
+     */
209 209
     public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale
210 210
     {
211 211
         if(!isset(self::$locales[$namespace])) {
@@ -343,45 +343,45 @@  discard block
 block discarded – undo
343 343
         return self::getSelectedLocaleByNS(self::NAMESPACE_APPLICATION);
344 344
     }
345 345
     
346
-   /**
347
-    * Retrieves the name of the selected application locale.
348
-    * 
349
-    * @return string
350
-    */
346
+    /**
347
+     * Retrieves the name of the selected application locale.
348
+     * 
349
+     * @return string
350
+     */
351 351
     public static function getAppLocaleName() : string
352 352
     {
353 353
         return self::getLocaleNameByNS(self::NAMESPACE_APPLICATION);
354 354
     }
355 355
     
356
-   /**
357
-    * Retrieves the names of the available application locales.
358
-    * @return string[]
359
-    */
356
+    /**
357
+     * Retrieves the names of the available application locales.
358
+     * @return string[]
359
+     */
360 360
     public static function getAppLocaleNames() : array
361 361
     {
362 362
         return self::getLocaleNamesByNS(self::NAMESPACE_APPLICATION);
363 363
     }
364 364
     
365
-   /**
366
-    * Retrieves the selected locale name in the specified namespace.
367
-    * 
368
-    * @param string $namespace
369
-    * @throws Localization_Exception
370
-    * @return string
371
-    */
365
+    /**
366
+     * Retrieves the selected locale name in the specified namespace.
367
+     * 
368
+     * @param string $namespace
369
+     * @throws Localization_Exception
370
+     * @return string
371
+     */
372 372
     public static function getLocaleNameByNS(string $namespace) : string
373 373
     {
374 374
         return self::getSelectedLocaleByNS($namespace)->getName();
375 375
     }
376 376
     
377
-   /**
378
-    * Retrieves the selected locale instance for the specified namespace.
379
-    * 
380
-    * @param string $namespace
381
-    * @return Localization_Locale
382
-    * @throws Localization_Exception
383
-    * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS
384
-    */
377
+    /**
378
+     * Retrieves the selected locale instance for the specified namespace.
379
+     * 
380
+     * @param string $namespace
381
+     * @return Localization_Locale
382
+     * @throws Localization_Exception
383
+     * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS
384
+     */
385 385
     public static function getSelectedLocaleByNS(string $namespace) : Localization_Locale
386 386
     {
387 387
         self::requireNamespace($namespace);
@@ -400,24 +400,24 @@  discard block
 block discarded – undo
400 400
         );
401 401
     }
402 402
     
403
-   /**
404
-    * Stores the selected locale names by namespace.
405
-    * @var array<string,Localization_Locale>
406
-    */
403
+    /**
404
+     * Stores the selected locale names by namespace.
405
+     * @var array<string,Localization_Locale>
406
+     */
407 407
     protected static $selected = array();
408 408
 
409
-   /**
410
-    * Selects the active locale for the specified namespace.
411
-    *
412
-    * NOTE: Triggers the "LocaleChanged" event.
413
-    * 
414
-    * @param string $localeName
415
-    * @param string $namespace
416
-    * @return Localization_Locale
417
-    * @throws Localization_Exception
418
-    *
419
-    * @see Localization_Event_LocaleChanged
420
-    */
409
+    /**
410
+     * Selects the active locale for the specified namespace.
411
+     *
412
+     * NOTE: Triggers the "LocaleChanged" event.
413
+     * 
414
+     * @param string $localeName
415
+     * @param string $namespace
416
+     * @return Localization_Locale
417
+     * @throws Localization_Exception
418
+     *
419
+     * @see Localization_Event_LocaleChanged
420
+     */
421 421
     public static function selectLocaleByNS(string $localeName, string $namespace) : Localization_Locale
422 422
     {
423 423
         self::requireNamespace($namespace);
@@ -548,15 +548,15 @@  discard block
 block discarded – undo
548 548
         return self::selectLocaleByNS($localeName, self::NAMESPACE_APPLICATION);
549 549
     }
550 550
 
551
-   /**
552
-    * Retrieves an application locale by its name. 
553
-    * Note that the locale must have been added first.
554
-    * 
555
-    * @param string $localeName
556
-    * @throws Localization_Exception
557
-    * @return Localization_Locale
558
-    * @see Localization::appLocaleExists()
559
-    */
551
+    /**
552
+     * Retrieves an application locale by its name. 
553
+     * Note that the locale must have been added first.
554
+     * 
555
+     * @param string $localeName
556
+     * @throws Localization_Exception
557
+     * @return Localization_Locale
558
+     * @see Localization::appLocaleExists()
559
+     */
560 560
     public static function getAppLocaleByName(string $localeName) : Localization_Locale
561 561
     {
562 562
         return self::getLocaleByNameNS($localeName, self::NAMESPACE_APPLICATION);
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
         return self::getLocalesByNS(self::NAMESPACE_CONTENT);
592 592
     }
593 593
     
594
-   /**
595
-    * Retrieves the names of all content locales that have been added.
596
-    * @return string[]
597
-    */
594
+    /**
595
+     * Retrieves the names of all content locales that have been added.
596
+     * @return string[]
597
+     */
598 598
     public static function getContentLocaleNames()
599 599
     {
600 600
         return self::getLocaleNamesByNS(self::NAMESPACE_CONTENT);
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
         sort($names);
618 618
         
619 619
         return $names;
620
-     }
620
+        }
621 621
     
622 622
     /**
623 623
      * Checks by the locale name if the specified locale is
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
         return self::getLocaleByNameNS($localeName, self::NAMESPACE_CONTENT);
647 647
     }
648 648
     
649
-   /**
650
-    * Retrieves a locale by its name in the specified namespace.
651
-    * 
652
-    * @param string $localeName
653
-    * @param string $namespace
654
-    * @throws Localization_Exception
655
-    * @return Localization_Locale
656
-    */
649
+    /**
650
+     * Retrieves a locale by its name in the specified namespace.
651
+     * 
652
+     * @param string $localeName
653
+     * @param string $namespace
654
+     * @throws Localization_Exception
655
+     * @return Localization_Locale
656
+     */
657 657
     public static function getLocaleByNameNS(string $localeName, string $namespace) : Localization_Locale
658 658
     {
659 659
         self::requireNamespace($namespace);
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
         return self::selectLocaleByNS($localeName, self::NAMESPACE_CONTENT);
725 725
     }
726 726
     
727
-   /**
728
-    * Checks whether the localization has been configured entirely.
729
-    * @return bool
730
-    */
727
+    /**
728
+     * Checks whether the localization has been configured entirely.
729
+     * @return bool
730
+     */
731 731
     public static function isConfigured() : bool
732 732
     {
733 733
         return self::$configured;
@@ -799,29 +799,29 @@  discard block
 block discarded – undo
799 799
         );
800 800
     }
801 801
     
802
-   /**
803
-    * Injects a content locales selector element into the specified
804
-    * HTML QuickForm2 container.
805
-    * 
806
-    * @param string $elementName
807
-    * @param HTML_QuickForm2_Container $container
808
-    * @param string $label
809
-    * @return HTML_QuickForm2_Element_Select
810
-    */
802
+    /**
803
+     * Injects a content locales selector element into the specified
804
+     * HTML QuickForm2 container.
805
+     * 
806
+     * @param string $elementName
807
+     * @param HTML_QuickForm2_Container $container
808
+     * @param string $label
809
+     * @return HTML_QuickForm2_Element_Select
810
+     */
811 811
     public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
812 812
     {
813 813
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label);
814 814
     }
815 815
     
816
-   /**
817
-    * Injects an app locales selector element into the specified
816
+    /**
817
+     * Injects an app locales selector element into the specified
818 818
      * HTML QuickForm2 container.
819 819
      * 
820
-    * @param string $elementName
821
-    * @param HTML_QuickForm2_Container $container
822
-    * @param string $label
823
-    * @return HTML_QuickForm2_Element_Select
824
-    */
820
+     * @param string $elementName
821
+     * @param HTML_QuickForm2_Container $container
822
+     * @param string $label
823
+     * @return HTML_QuickForm2_Element_Select
824
+     */
825 825
     public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select
826 826
     {
827 827
         return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label);
@@ -857,26 +857,26 @@  discard block
 block discarded – undo
857 857
         return $select;
858 858
     }
859 859
 
860
-   /**
861
-    * @var Localization_Source[]
862
-    */
860
+    /**
861
+     * @var Localization_Source[]
862
+     */
863 863
     protected static $sources = array();
864 864
     
865
-   /**
866
-    * @var string[]
867
-    */
865
+    /**
866
+     * @var string[]
867
+     */
868 868
     protected static $excludeFolders = array();
869 869
     
870
-   /**
871
-    * @var string[]
872
-    */
870
+    /**
871
+     * @var string[]
872
+     */
873 873
     protected static $excludeFiles = array();
874 874
     
875
-   /**
876
-    * Retrieves all currently available sources.
877
-    * 
878
-    * @return Localization_Source[]
879
-    */
875
+    /**
876
+     * Retrieves all currently available sources.
877
+     * 
878
+     * @return Localization_Source[]
879
+     */
880 880
     public static function getSources() : array
881 881
     {
882 882
         return self::$sources;
@@ -908,10 +908,10 @@  discard block
 block discarded – undo
908 908
         return $source;
909 909
     }
910 910
     
911
-   /**
912
-    * Retrieves all sources grouped by their group name.
913
-    * @return array
914
-    */
911
+    /**
912
+     * Retrieves all sources grouped by their group name.
913
+     * @return array
914
+     */
915 915
     public static function getSourcesGrouped()
916 916
     {
917 917
         $sources = self::getSources();
@@ -932,11 +932,11 @@  discard block
 block discarded – undo
932 932
         return $grouped;
933 933
     }
934 934
     
935
-   /**
936
-    * Checks whether a specific source exists by its ID.
937
-    * @param string $sourceID
938
-    * @return boolean
939
-    */
935
+    /**
936
+     * Checks whether a specific source exists by its ID.
937
+     * @param string $sourceID
938
+     * @return boolean
939
+     */
940 940
     public static function sourceExists(string $sourceID) : bool
941 941
     {
942 942
         $sources = self::getSources();
@@ -949,11 +949,11 @@  discard block
 block discarded – undo
949 949
         return false;
950 950
     }
951 951
     
952
-   /**
953
-    * Checks whether a specific source exists by its alias.
954
-    * @param string $sourceAlias
955
-    * @return boolean
956
-    */
952
+    /**
953
+     * Checks whether a specific source exists by its alias.
954
+     * @param string $sourceAlias
955
+     * @return boolean
956
+     */
957 957
     public static function sourceAliasExists(string $sourceAlias) : bool
958 958
     {
959 959
         $sources = self::getSources();
@@ -966,13 +966,13 @@  discard block
 block discarded – undo
966 966
         return false;
967 967
     }
968 968
 
969
-   /**
970
-    * Retrieves a localization source by its ID.
971
-    * 
972
-    * @param string $sourceID
973
-    * @throws Localization_Exception
974
-    * @return Localization_Source
975
-    */
969
+    /**
970
+     * Retrieves a localization source by its ID.
971
+     * 
972
+     * @param string $sourceID
973
+     * @throws Localization_Exception
974
+     * @return Localization_Source
975
+     */
976 976
     public static function getSourceByID(string $sourceID) : Localization_Source
977 977
     {
978 978
         $sources = self::getSources();
@@ -1062,17 +1062,17 @@  discard block
 block discarded – undo
1062 1062
         }
1063 1063
     }
1064 1064
     
1065
-   /**
1066
-    * Sets a key that is used to verify whether the client
1067
-    * libraries have to be refreshed. A common use is to set
1068
-    * this to the application's version number to guarantee
1069
-    * new texts are automatically used with each release.
1070
-    * 
1071
-    * NOTE: Otherwise files are refreshed only when saving 
1072
-    * them in the editor UI.
1073
-    *  
1074
-    * @param string $key
1075
-    */
1065
+    /**
1066
+     * Sets a key that is used to verify whether the client
1067
+     * libraries have to be refreshed. A common use is to set
1068
+     * this to the application's version number to guarantee
1069
+     * new texts are automatically used with each release.
1070
+     * 
1071
+     * NOTE: Otherwise files are refreshed only when saving 
1072
+     * them in the editor UI.
1073
+     *  
1074
+     * @param string $key
1075
+     */
1076 1076
     public static function setClientLibrariesCacheKey(string $key) : void
1077 1077
     {
1078 1078
         self::$clientCacheKey = $key;
@@ -1083,23 +1083,23 @@  discard block
 block discarded – undo
1083 1083
         return self::$clientCacheKey;
1084 1084
     }
1085 1085
     
1086
-   /**
1087
-    * Sets the folder where client libraries are to be stored.
1088
-    * @param string $folder
1089
-    */
1086
+    /**
1087
+     * Sets the folder where client libraries are to be stored.
1088
+     * @param string $folder
1089
+     */
1090 1090
     public static function setClientLibrariesFolder(string $folder) : void
1091 1091
     {
1092 1092
         self::$clientFolder = $folder;
1093 1093
     }
1094 1094
     
1095
-   /**
1096
-    * Retrieves the path to the folder in which the client
1097
-    * libraries should be stored.
1098
-    * 
1099
-    * NOTE: Can return an empty string, when this is disabled.
1100
-    * 
1101
-    * @return string
1102
-    */
1095
+    /**
1096
+     * Retrieves the path to the folder in which the client
1097
+     * libraries should be stored.
1098
+     * 
1099
+     * NOTE: Can return an empty string, when this is disabled.
1100
+     * 
1101
+     * @return string
1102
+     */
1103 1103
     public static function getClientLibrariesFolder() : string
1104 1104
     {
1105 1105
         return self::$clientFolder;
@@ -1119,13 +1119,13 @@  discard block
 block discarded – undo
1119 1119
         self::createGenerator()->writeFiles($force);
1120 1120
     }
1121 1121
     
1122
-   /**
1123
-    * Creates a new instance of the client generator class
1124
-    * that is used to write the localization files into the
1125
-    * target folder on disk.
1126
-    * 
1127
-    * @return Localization_ClientGenerator
1128
-    */
1122
+    /**
1123
+     * Creates a new instance of the client generator class
1124
+     * that is used to write the localization files into the
1125
+     * target folder on disk.
1126
+     * 
1127
+     * @return Localization_ClientGenerator
1128
+     */
1129 1129
     public static function createGenerator() : Localization_ClientGenerator
1130 1130
     {
1131 1131
         return new Localization_ClientGenerator();
@@ -1190,10 +1190,10 @@  discard block
 block discarded – undo
1190 1190
         return new Localization_Editor();
1191 1191
     }
1192 1192
     
1193
-   /**
1194
-    * Retrieves a list of all available source IDs.
1195
-    * @return string[]
1196
-    */
1193
+    /**
1194
+     * Retrieves a list of all available source IDs.
1195
+     * @return string[]
1196
+     */
1197 1197
     public static function getSourceIDs() : array
1198 1198
     {
1199 1199
         $ids = array();
@@ -1220,9 +1220,9 @@  discard block
 block discarded – undo
1220 1220
         return $aliases;
1221 1221
     }
1222 1222
     
1223
-   /**
1224
-    * Resets all locales to the built-in locale.
1225
-    */
1223
+    /**
1224
+     * Resets all locales to the built-in locale.
1225
+     */
1226 1226
     public static function reset() : void
1227 1227
     {
1228 1228
         self::$locales = array();
@@ -1260,12 +1260,12 @@  discard block
 block discarded – undo
1260 1260
         return self::$supportedLocales;
1261 1261
     }
1262 1262
     
1263
-   /**
1264
-    * Checks whether the specified locale is supported.
1265
-    * 
1266
-    * @param string $localeName
1267
-    * @return bool
1268
-    */
1263
+    /**
1264
+     * Checks whether the specified locale is supported.
1265
+     * 
1266
+     * @param string $localeName
1267
+     * @return bool
1268
+     */
1269 1269
     public static function isLocaleSupported(string $localeName) : bool
1270 1270
     {
1271 1271
         return file_exists(__DIR__.'/Localization/Locale/'.$localeName.'.php');
Please login to merge, or discard this patch.
src/Localization/Locale.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
      */
33 33
     protected $country;
34 34
     
35
-   /**
36
-    * @var string
37
-    */
35
+    /**
36
+     * @var string
37
+     */
38 38
     protected $countryCode;
39 39
     
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $languageCode;
44 44
 
45 45
     public function __construct()
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         $this->languageCode = strtolower($tokens[0]);
54 54
     }
55 55
     
56
-   /**
57
-    * Retrieves the two-letter language code of the locale.
58
-    * 
59
-    * @return string Language code, e.g. "en", "de"
60
-    */
56
+    /**
57
+     * Retrieves the two-letter language code of the locale.
58
+     * 
59
+     * @return string Language code, e.g. "en", "de"
60
+     */
61 61
     public function getLanguageCode() : string
62 62
     {
63 63
         return $this->languageCode;
@@ -84,25 +84,25 @@  discard block
 block discarded – undo
84 84
         return $this->localeName;
85 85
     }
86 86
     
87
-   /**
88
-    * Retrieves the shortened version of the locale name,
89
-    * e.g. "en" or "de".
90
-    *
91
-    * @return string
92
-    * @deprecated
93
-    * @see Localization_Locale::getLanguageCode()
94
-    */
87
+    /**
88
+     * Retrieves the shortened version of the locale name,
89
+     * e.g. "en" or "de".
90
+     *
91
+     * @return string
92
+     * @deprecated
93
+     * @see Localization_Locale::getLanguageCode()
94
+     */
95 95
     public function getShortName() : string
96 96
     {
97 97
         return $this->getLanguageCode();
98 98
     }
99 99
     
100
-   /**
101
-    * Retrieves the two-letter country code of
102
-    * the locale.
103
-    * 
104
-    * @return string Lowercase code, e.g. "uk"
105
-    */
100
+    /**
101
+     * Retrieves the two-letter country code of
102
+     * the locale.
103
+     * 
104
+     * @return string Lowercase code, e.g. "uk"
105
+     */
106 106
     public function getCountryCode() : string
107 107
     {
108 108
         return $this->countryCode;
Please login to merge, or discard this patch.
src/Localization/Scanner/StringHash.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class Localization_Scanner_StringHash
17 17
 {
18
-   /**
19
-    * @var Localization_Scanner_StringsCollection
20
-    */
18
+    /**
19
+     * @var Localization_Scanner_StringsCollection
20
+     */
21 21
     protected $collection;
22 22
     
23
-   /**
24
-    * @var string
25
-    */
23
+    /**
24
+     * @var string
25
+     */
26 26
     protected $hash;
27 27
     
28
-   /**
29
-    * @var Localization_Scanner_StringInfo[]
30
-    */
28
+    /**
29
+     * @var Localization_Scanner_StringInfo[]
30
+     */
31 31
     protected $strings = array();
32 32
 
33 33
     /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
         return $entries;
61 61
     }
62 62
     
63
-   /**
64
-    * Retrieves all individual string locations where this text was found.
65
-    * @return Localization_Scanner_StringInfo[]
66
-    */
63
+    /**
64
+     * Retrieves all individual string locations where this text was found.
65
+     * @return Localization_Scanner_StringInfo[]
66
+     */
67 67
     public function getStrings() : array
68 68
     {
69 69
         return $this->strings;
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
         return count($this->strings);
124 124
     }
125 125
     
126
-   /**
127
-    * Retrieves the translated text, if any.
128
-    * @return string
129
-    */
126
+    /**
127
+     * Retrieves the translated text, if any.
128
+     * @return string
129
+     */
130 130
     public function getTranslatedText() : string
131 131
     {
132 132
         $translator = Localization::getTranslator();
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
         return '';
140 140
     }
141 141
     
142
-   /**
143
-    * Retrieves a list of all file names, with relative paths.
144
-    * @return string[]
145
-    */
142
+    /**
143
+     * Retrieves a list of all file names, with relative paths.
144
+     * @return string[]
145
+     */
146 146
     public function getFiles() : array
147 147
     {
148 148
         $files = array();
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
         return $files;
165 165
     }
166 166
     
167
-   /**
168
-    * Retrieves a list of all file names this string is used in.
169
-    * @return string[]
170
-    */
167
+    /**
168
+     * Retrieves a list of all file names this string is used in.
169
+     * @return string[]
170
+     */
171 171
     public function getFileNames() : array
172 172
     {
173 173
         $files = $this->getFiles();
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
         return array_unique($result);
183 183
     }
184 184
     
185
-   /**
186
-    * Retrieves a text comprised of all strings that are relevant
187
-    * for a full text search, imploded together. Used in the search
188
-    * function to find matching strings.
189
-    * 
190
-    * @return string
191
-    */
185
+    /**
186
+     * Retrieves a text comprised of all strings that are relevant
187
+     * for a full text search, imploded together. Used in the search
188
+     * function to find matching strings.
189
+     * 
190
+     * @return string
191
+     */
192 192
     public function getSearchString() : string
193 193
     {
194 194
         $parts = array($this->getTranslatedText(), $this->getText()->getText());
Please login to merge, or discard this patch.
src/Localization/Parser/Language.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -23,49 +23,49 @@  discard block
 block discarded – undo
23 23
      */
24 24
     protected $parser;
25 25
 
26
-   /**
27
-    * The function names that are included in the search.
28
-    * @var array
29
-    */
26
+    /**
27
+     * The function names that are included in the search.
28
+     * @var array
29
+     */
30 30
     protected $functionNames = array();
31 31
     
32
-   /**
33
-    * The tokens definitions.
34
-    * @var array
35
-    */
32
+    /**
33
+     * The tokens definitions.
34
+     * @var array
35
+     */
36 36
     protected $tokens = array();
37 37
     
38
-   /**
39
-    * The total amount of tokens found in the content.
40
-    * @var integer
41
-    */
38
+    /**
39
+     * The total amount of tokens found in the content.
40
+     * @var integer
41
+     */
42 42
     protected $totalTokens = 0;
43 43
     
44
-   /**
45
-    * All texts that have been collected.
46
-    * @var Text[]
47
-    */
44
+    /**
45
+     * All texts that have been collected.
46
+     * @var Text[]
47
+     */
48 48
     protected $texts = array();
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $content = '';
54 54
 
55
-   /**
56
-    * @var string|NULL
57
-    */
55
+    /**
56
+     * @var string|NULL
57
+     */
58 58
     protected $id;
59 59
     
60
-   /**
61
-    * @var Localization_Parser_Warning[]
62
-    */
60
+    /**
61
+     * @var Localization_Parser_Warning[]
62
+     */
63 63
     protected $warnings = array();
64 64
     
65
-   /**
66
-    * The source file that was parsed (if any)
67
-    * @var string
68
-    */
65
+    /**
66
+     * The source file that was parsed (if any)
67
+     * @var string
68
+     */
69 69
     protected $sourceFile = '';
70 70
 
71 71
     /**
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
     
92 92
     abstract protected function getTokens() : array;
93 93
     
94
-   /**
95
-    * Retrieves the ID of the language.
96
-    * @return string E.g. "PHP", "Javascript"
97
-    */
94
+    /**
95
+     * Retrieves the ID of the language.
96
+     * @return string E.g. "PHP", "Javascript"
97
+     */
98 98
     public function getID() : string
99 99
     {
100 100
         if(!isset($this->id)) {
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
         return $this->sourceFile;
115 115
     }
116 116
     
117
-   /**
118
-    * Parses the code from a file.
119
-    * 
120
-    * @param string $path
121
-    * @throws Localization_Exception
122
-    */
117
+    /**
118
+     * Parses the code from a file.
119
+     * 
120
+     * @param string $path
121
+     * @throws Localization_Exception
122
+     */
123 123
     public function parseFile(string $path) : void
124 124
     {
125 125
         if(!file_exists($path)) 
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
         $this->parse();
157 157
     }
158 158
     
159
-   /**
160
-    * Parses a source code string.
161
-    * @param string $content
162
-    */
159
+    /**
160
+     * Parses a source code string.
161
+     * @param string $content
162
+     */
163 163
     public function parseString(string $content) : void
164 164
     {
165 165
         $this->content = $content;
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
         $this->texts[] = new Text($text, $line, $explanation);
215 215
     }
216 216
 
217
-   /**
218
-    * Retrieves a list of all the function names that are
219
-    * used as translation functions in the language.
220
-    * @return array
221
-    */
217
+    /**
218
+     * Retrieves a list of all the function names that are
219
+     * used as translation functions in the language.
220
+     * @return array
221
+     */
222 222
     public function getFunctionNames() : array
223 223
     {
224 224
         return $this->createToken('dummy')->getFunctionNames();
@@ -229,13 +229,13 @@  discard block
 block discarded – undo
229 229
         Localization::log(sprintf('%1$s parser | %2$s', $this->getID(), $message));
230 230
     }
231 231
 
232
-   /**
233
-    * Adds a warning message when a text cannot be parsed correctly for some reason.
234
-    * 
235
-    * @param Localization_Parser_Token $token
236
-    * @param string $message
237
-    * @return Localization_Parser_Warning
238
-    */
232
+    /**
233
+     * Adds a warning message when a text cannot be parsed correctly for some reason.
234
+     * 
235
+     * @param Localization_Parser_Token $token
236
+     * @param string $message
237
+     * @return Localization_Parser_Warning
238
+     */
239 239
     protected function addWarning(Localization_Parser_Token $token, string $message) : Localization_Parser_Warning
240 240
     {
241 241
         $warning = new Localization_Parser_Warning($this, $token, $message);
@@ -245,34 +245,34 @@  discard block
 block discarded – undo
245 245
         return $warning;
246 246
     }
247 247
     
248
-   /**
249
-    * Whether any warnings were generated during parsing.
250
-    * @return bool
251
-    */
248
+    /**
249
+     * Whether any warnings were generated during parsing.
250
+     * @return bool
251
+     */
252 252
     public function hasWarnings() : bool
253 253
     {
254 254
         return !empty($this->warnings);
255 255
     }
256 256
     
257
-   /**
258
-    * Retrieves all warnings that were generated during parsing,
259
-    * if any.
260
-    * 
261
-    * @return Localization_Parser_Warning[]
262
-    */
257
+    /**
258
+     * Retrieves all warnings that were generated during parsing,
259
+     * if any.
260
+     * 
261
+     * @return Localization_Parser_Warning[]
262
+     */
263 263
     public function getWarnings() : array
264 264
     {
265 265
         return $this->warnings;
266 266
     }
267 267
     
268
-   /**
269
-    * Creates a token instance: this retrieves information on
270
-    * the language token being parsed.
271
-    * 
272
-    * @param array|string $definition The token definition.
273
-    * @param Localization_Parser_Token|NULL $parentToken
274
-    * @return Localization_Parser_Token
275
-    */
268
+    /**
269
+     * Creates a token instance: this retrieves information on
270
+     * the language token being parsed.
271
+     * 
272
+     * @param array|string $definition The token definition.
273
+     * @param Localization_Parser_Token|NULL $parentToken
274
+     * @return Localization_Parser_Token
275
+     */
276 276
     protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token
277 277
     {
278 278
         $class = Localization_Parser_Token::class.'_'.$this->getID();
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
         return new $class($definition, $parentToken);
281 281
     }
282 282
 
283
-   /**
284
-    * Parses a translation function token.
285
-    * 
286
-    * @param int $number
287
-    * @param Localization_Parser_Token $token
288
-    */
283
+    /**
284
+     * Parses a translation function token.
285
+     * 
286
+     * @param int $number
287
+     * @param Localization_Parser_Token $token
288
+     */
289 289
     protected function parseToken(int $number, Localization_Parser_Token $token) : void
290 290
     {
291 291
         $textParts = array();
Please login to merge, or discard this patch.