@@ -16,9 +16,9 @@ |
||
16 | 16 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
17 | 17 | } |
18 | 18 | |
19 | - /** |
|
20 | - * The composer autoloader |
|
21 | - */ |
|
19 | + /** |
|
20 | + * The composer autoloader |
|
21 | + */ |
|
22 | 22 | require_once $autoload; |
23 | 23 | |
24 | 24 | // the folder in which the localization .ini files are stored |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | abstract class Localization_Event |
22 | 22 | { |
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | 26 | protected $args; |
27 | 27 | |
28 | 28 | public function __construct(array $args) |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | $this->args = $args; |
31 | 31 | } |
32 | 32 | |
33 | - /** |
|
34 | - * Fetches the argument at the specified index in the |
|
35 | - * event's arguments list, if it exists. |
|
36 | - * |
|
37 | - * @param int $index Zero-based index number. |
|
38 | - * @return mixed|NULL |
|
39 | - */ |
|
33 | + /** |
|
34 | + * Fetches the argument at the specified index in the |
|
35 | + * event's arguments list, if it exists. |
|
36 | + * |
|
37 | + * @param int $index Zero-based index number. |
|
38 | + * @return mixed|NULL |
|
39 | + */ |
|
40 | 40 | public function getArgument(int $index) |
41 | 41 | { |
42 | 42 | if(isset($this->args[$index])) { |
@@ -6,9 +6,9 @@ |
||
6 | 6 | |
7 | 7 | class Localization_Scanner_StringsCollection_Warning |
8 | 8 | { |
9 | - /** |
|
10 | - * @var array |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var array |
|
11 | + */ |
|
12 | 12 | protected $data; |
13 | 13 | |
14 | 14 | public function __construct(array $data) |
@@ -12,8 +12,8 @@ |
||
12 | 12 | const SERIALIZED_PROPERTIES = 'properties'; |
13 | 13 | |
14 | 14 | /** |
15 | - * @var Localization_Scanner_StringsCollection |
|
16 | - */ |
|
15 | + * @var Localization_Scanner_StringsCollection |
|
16 | + */ |
|
17 | 17 | protected $collection; |
18 | 18 | |
19 | 19 | /** |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | const ERROR_UNSUPPORTED_FILE_EXTENSION = 40602; |
31 | 31 | const ERROR_INVALID_LANGUAGE_CLASS = 40603; |
32 | 32 | |
33 | - /** |
|
34 | - * @var Localization_Scanner |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var Localization_Scanner |
|
35 | + */ |
|
36 | 36 | protected $scanner; |
37 | 37 | |
38 | - /** |
|
39 | - * @var Localization_Scanner_StringsCollection |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var Localization_Scanner_StringsCollection |
|
40 | + */ |
|
41 | 41 | protected $collection; |
42 | 42 | |
43 | 43 | /** |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | $this->collection = $scanner->getCollection(); |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Parses a source file. Must have a valid supported file extension. |
|
59 | - * |
|
60 | - * @param string $path |
|
61 | - * @return Localization_Parser_Language |
|
62 | - * @throws Localization_Exception |
|
63 | - * |
|
64 | - * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
65 | - */ |
|
57 | + /** |
|
58 | + * Parses a source file. Must have a valid supported file extension. |
|
59 | + * |
|
60 | + * @param string $path |
|
61 | + * @return Localization_Parser_Language |
|
62 | + * @throws Localization_Exception |
|
63 | + * |
|
64 | + * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
65 | + */ |
|
66 | 66 | public function parseFile(string $path) : Localization_Parser_Language |
67 | 67 | { |
68 | 68 | $this->requireValidFile($path); |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | return $language; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Parses the string for the specified language. |
|
81 | - * |
|
82 | - * @param string $languageID |
|
83 | - * @param string $code |
|
84 | - * @return Localization_Parser_Language |
|
85 | - * @throws Localization_Exception |
|
86 | - * |
|
87 | - * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
88 | - */ |
|
79 | + /** |
|
80 | + * Parses the string for the specified language. |
|
81 | + * |
|
82 | + * @param string $languageID |
|
83 | + * @param string $code |
|
84 | + * @return Localization_Parser_Language |
|
85 | + * @throws Localization_Exception |
|
86 | + * |
|
87 | + * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
88 | + */ |
|
89 | 89 | public function parseString(string $languageID, string $code) : Localization_Parser_Language |
90 | 90 | { |
91 | 91 | $this->requireValidLanguageID($languageID); |
@@ -144,18 +144,18 @@ discard block |
||
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | - /** |
|
148 | - * Retrieves a list of all language IDs that are supported. |
|
149 | - * @return string[] IDs list like "PHP", "Javascript" |
|
150 | - */ |
|
147 | + /** |
|
148 | + * Retrieves a list of all language IDs that are supported. |
|
149 | + * @return string[] IDs list like "PHP", "Javascript" |
|
150 | + */ |
|
151 | 151 | public function getLanguageIDs() : array |
152 | 152 | { |
153 | 153 | return array_values($this->languageMappings); |
154 | 154 | } |
155 | 155 | |
156 | - /** |
|
157 | - * @var array<string,Localization_Parser_Language> |
|
158 | - */ |
|
156 | + /** |
|
157 | + * @var array<string,Localization_Parser_Language> |
|
158 | + */ |
|
159 | 159 | protected $languageParsers = array(); |
160 | 160 | |
161 | 161 | /** |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | ); |
210 | 210 | } |
211 | 211 | |
212 | - /** |
|
213 | - * Whether the specified file extension is supported. |
|
214 | - * |
|
215 | - * @param string $ext |
|
216 | - * @return bool |
|
217 | - */ |
|
212 | + /** |
|
213 | + * Whether the specified file extension is supported. |
|
214 | + * |
|
215 | + * @param string $ext |
|
216 | + * @return bool |
|
217 | + */ |
|
218 | 218 | public function isExtensionSupported(string $ext) : bool |
219 | 219 | { |
220 | 220 | $ext = strtolower($ext); |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | protected $reverseStrings = array(); |
58 | 58 | |
59 | 59 | /** |
60 | - * @var Localization_Source[] |
|
61 | - */ |
|
60 | + * @var Localization_Source[] |
|
61 | + */ |
|
62 | 62 | private $sources = array(); |
63 | 63 | |
64 | 64 | /** |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | ); |
192 | 192 | } |
193 | 193 | |
194 | - /** |
|
195 | - * Retrieves all available strings for the specified locale, |
|
196 | - * as hash => text value pairs. |
|
197 | - * |
|
198 | - * @param Localization_Locale $locale |
|
199 | - * @throws Localization_Exception |
|
200 | - * @return string[] |
|
201 | - */ |
|
194 | + /** |
|
195 | + * Retrieves all available strings for the specified locale, |
|
196 | + * as hash => text value pairs. |
|
197 | + * |
|
198 | + * @param Localization_Locale $locale |
|
199 | + * @throws Localization_Exception |
|
200 | + * @return string[] |
|
201 | + */ |
|
202 | 202 | public function getStrings(Localization_Locale $locale) : array |
203 | 203 | { |
204 | 204 | $this->load($locale); |
@@ -24,24 +24,24 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class Localization_Scanner |
26 | 26 | { |
27 | - /** |
|
28 | - * @var float |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var float |
|
29 | + */ |
|
30 | 30 | protected $timeStart; |
31 | 31 | |
32 | - /** |
|
33 | - * @var float |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var float |
|
34 | + */ |
|
35 | 35 | protected $timeEnd; |
36 | 36 | |
37 | - /** |
|
38 | - * @var array |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var array |
|
39 | + */ |
|
40 | 40 | protected $stringInfos = array(); |
41 | 41 | |
42 | - /** |
|
43 | - * @var string |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var string |
|
44 | + */ |
|
45 | 45 | protected $storageFile; |
46 | 46 | |
47 | 47 | /** |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | return $this->getCollection()->countWarnings(); |
173 | 173 | } |
174 | 174 | |
175 | - /** |
|
176 | - * Retrieves all warnings that have been registered |
|
177 | - * during the last search for translatable texts. |
|
178 | - * |
|
179 | - * @return Localization_Scanner_StringsCollection_Warning[] |
|
180 | - */ |
|
175 | + /** |
|
176 | + * Retrieves all warnings that have been registered |
|
177 | + * during the last search for translatable texts. |
|
178 | + * |
|
179 | + * @return Localization_Scanner_StringsCollection_Warning[] |
|
180 | + */ |
|
181 | 181 | public function getWarnings() : array |
182 | 182 | { |
183 | 183 | return $this->getCollection()->getWarnings(); |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Localization_Writer |
22 | 22 | { |
23 | - /** |
|
24 | - * @var boolean |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var boolean |
|
25 | + */ |
|
26 | 26 | private $editable = false; |
27 | 27 | |
28 | - /** |
|
29 | - * @var array<string,string> |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var array<string,string> |
|
30 | + */ |
|
31 | 31 | private $hashes = array(); |
32 | 32 | |
33 | - /** |
|
34 | - * @var Localization_Locale |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var Localization_Locale |
|
35 | + */ |
|
36 | 36 | private $locale; |
37 | 37 | |
38 | - /** |
|
39 | - * @var string |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var string |
|
40 | + */ |
|
41 | 41 | private $fileType; |
42 | 42 | |
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | 46 | private $filePath; |
47 | 47 | |
48 | 48 | public function __construct(Localization_Locale $locale, string $fileType, string $filePath) |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | return $hashes; |
151 | 151 | } |
152 | 152 | |
153 | - /** |
|
154 | - * Sort the strings to ensure they always appear in the same order: |
|
155 | - * first by text, and same strings by their hashes. This is important |
|
156 | - * for strings that have the same translation to avoid them changing |
|
157 | - * order between sorts. |
|
158 | - * |
|
159 | - * @param array $a |
|
160 | - * @param array $b |
|
161 | - * @return int |
|
162 | - */ |
|
153 | + /** |
|
154 | + * Sort the strings to ensure they always appear in the same order: |
|
155 | + * first by text, and same strings by their hashes. This is important |
|
156 | + * for strings that have the same translation to avoid them changing |
|
157 | + * order between sorts. |
|
158 | + * |
|
159 | + * @param array $a |
|
160 | + * @param array $b |
|
161 | + * @return int |
|
162 | + */ |
|
163 | 163 | public function callback_sortStrings(array $a, array $b) : int |
164 | 164 | { |
165 | 165 | $result = strnatcasecmp($a['text'], $b['text']); |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | |
13 | 13 | const STORAGE_FORMAT_VERSION = 2; |
14 | 14 | |
15 | - /** |
|
16 | - * @var Localization_Scanner |
|
17 | - */ |
|
15 | + /** |
|
16 | + * @var Localization_Scanner |
|
17 | + */ |
|
18 | 18 | protected $scanner; |
19 | 19 | |
20 | - /** |
|
21 | - * @var Localization_Scanner_StringHash[] |
|
22 | - */ |
|
20 | + /** |
|
21 | + * @var Localization_Scanner_StringHash[] |
|
22 | + */ |
|
23 | 23 | protected $hashes = array(); |
24 | 24 | |
25 | - /** |
|
26 | - * @var array |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var array |
|
27 | + */ |
|
28 | 28 | protected $warnings = array(); |
29 | 29 | |
30 | 30 | public function __construct(Localization_Scanner $scanner) |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | return new Localization_Scanner_StringInfo($this, $sourceID, $sourceType, $text); |
53 | 53 | } |
54 | 54 | |
55 | - /** |
|
56 | - * Adds a single translatable string. |
|
57 | - * |
|
58 | - * @param Localization_Scanner_StringInfo $string |
|
59 | - * @return Localization_Scanner_StringsCollection |
|
60 | - */ |
|
55 | + /** |
|
56 | + * Adds a single translatable string. |
|
57 | + * |
|
58 | + * @param Localization_Scanner_StringInfo $string |
|
59 | + * @return Localization_Scanner_StringsCollection |
|
60 | + */ |
|
61 | 61 | protected function add(Localization_Scanner_StringInfo $string) : Localization_Scanner_StringsCollection |
62 | 62 | { |
63 | 63 | $hash = $string->getHash(); |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | - /** |
|
74 | - * Retrieves all available translatable strings, |
|
75 | - * grouped by their hash to identify unique strings. |
|
76 | - * |
|
77 | - * @return Localization_Scanner_StringHash[] |
|
78 | - */ |
|
73 | + /** |
|
74 | + * Retrieves all available translatable strings, |
|
75 | + * grouped by their hash to identify unique strings. |
|
76 | + * |
|
77 | + * @return Localization_Scanner_StringHash[] |
|
78 | + */ |
|
79 | 79 | public function getHashes() : array |
80 | 80 | { |
81 | 81 | return array_values($this->hashes); |
@@ -146,32 +146,32 @@ discard block |
||
146 | 146 | return true; |
147 | 147 | } |
148 | 148 | |
149 | - /** |
|
150 | - * Whether the parser reported warnings during the |
|
151 | - * search for translatable texts. |
|
152 | - * |
|
153 | - * @return bool |
|
154 | - */ |
|
149 | + /** |
|
150 | + * Whether the parser reported warnings during the |
|
151 | + * search for translatable texts. |
|
152 | + * |
|
153 | + * @return bool |
|
154 | + */ |
|
155 | 155 | public function hasWarnings() : bool |
156 | 156 | { |
157 | 157 | return !empty($this->warnings); |
158 | 158 | } |
159 | 159 | |
160 | - /** |
|
161 | - * Retrieves the amount of warnings. |
|
162 | - * @return int |
|
163 | - */ |
|
160 | + /** |
|
161 | + * Retrieves the amount of warnings. |
|
162 | + * @return int |
|
163 | + */ |
|
164 | 164 | public function countWarnings() : int |
165 | 165 | { |
166 | 166 | return count($this->warnings); |
167 | 167 | } |
168 | 168 | |
169 | - /** |
|
170 | - * Retrieves all warning messages that were added |
|
171 | - * during the search for translatable texts, if any. |
|
172 | - * |
|
173 | - * @return Localization_Scanner_StringsCollection_Warning[] |
|
174 | - */ |
|
169 | + /** |
|
170 | + * Retrieves all warning messages that were added |
|
171 | + * during the search for translatable texts, if any. |
|
172 | + * |
|
173 | + * @return Localization_Scanner_StringsCollection_Warning[] |
|
174 | + */ |
|
175 | 175 | public function getWarnings() : array |
176 | 176 | { |
177 | 177 | $result = array(); |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | return $amount; |
199 | 199 | } |
200 | 200 | |
201 | - /** |
|
202 | - * Retrieves all string hashed for the specified source. |
|
203 | - * |
|
204 | - * @param string $id |
|
205 | - * @return Localization_Scanner_StringHash[] |
|
206 | - */ |
|
201 | + /** |
|
202 | + * Retrieves all string hashed for the specified source. |
|
203 | + * |
|
204 | + * @param string $id |
|
205 | + * @return Localization_Scanner_StringHash[] |
|
206 | + */ |
|
207 | 207 | public function getHashesBySourceID(string $id) : array |
208 | 208 | { |
209 | 209 | $hashes = array(); |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | return $hashes; |
218 | 218 | } |
219 | 219 | |
220 | - /** |
|
221 | - * Retrieves all hashes for the specified language ID. |
|
222 | - * |
|
223 | - * @param string $languageID The language ID, e.g. "PHP" |
|
224 | - * @return Localization_Scanner_StringHash[] |
|
225 | - */ |
|
220 | + /** |
|
221 | + * Retrieves all hashes for the specified language ID. |
|
222 | + * |
|
223 | + * @param string $languageID The language ID, e.g. "PHP" |
|
224 | + * @return Localization_Scanner_StringHash[] |
|
225 | + */ |
|
226 | 226 | public function getHashesByLanguageID(string $languageID) : array |
227 | 227 | { |
228 | 228 | $hashes = array(); |