@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | foreach($defaults as $name => $val) { |
51 | 51 | $this->setValue($name, $val); |
52 | 52 | } |
53 | - } |
|
54 | - else if($this->request->getBool($this->vars['filter'])) |
|
53 | + } else if($this->request->getBool($this->vars['filter'])) |
|
55 | 54 | { |
56 | 55 | $this->parseSearchTerms($this->request->getParam($this->vars['search'])); |
57 | 56 | |
@@ -72,8 +71,7 @@ discard block |
||
72 | 71 | ->setEnum('', 'client', 'server') |
73 | 72 | ->get('') |
74 | 73 | ); |
75 | - } |
|
76 | - else |
|
74 | + } else |
|
77 | 75 | { |
78 | 76 | $this->parseSearchTerms($this->getValue($this->vars['search'])); |
79 | 77 | } |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class Localization_Editor_Filters |
25 | 25 | { |
26 | - /** |
|
27 | - * @var Localization_Editor |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var Localization_Editor |
|
28 | + */ |
|
29 | 29 | protected $editor; |
30 | 30 | |
31 | - /** |
|
32 | - * @var Request |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var Request |
|
33 | + */ |
|
34 | 34 | |
35 | 35 | protected $request; |
36 | 36 | |
37 | - /** |
|
38 | - * @var string |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var string |
|
39 | + */ |
|
40 | 40 | protected $sessionName = 'localize_filters'; |
41 | 41 | |
42 | - /** |
|
43 | - * @var string[] |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var string[] |
|
44 | + */ |
|
45 | 45 | protected $vars = array( |
46 | 46 | 'resetfilter' => '', |
47 | 47 | 'filter' => '', |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | <form class="form-inline"> |
205 | 205 | <div class="form-hiddens"> |
206 | 206 | <?php |
207 | - $params = $this->editor->getRequestParams(); |
|
208 | - foreach($params as $name => $value) { |
|
209 | - ?> |
|
207 | + $params = $this->editor->getRequestParams(); |
|
208 | + foreach($params as $name => $value) { |
|
209 | + ?> |
|
210 | 210 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
211 | 211 | <?php |
212 | - } |
|
213 | - ?> |
|
212 | + } |
|
213 | + ?> |
|
214 | 214 | </div> |
215 | 215 | <div class="form-row"> |
216 | 216 | <div class="col-auto"> |
@@ -218,42 +218,42 @@ discard block |
||
218 | 218 | </div> |
219 | 219 | <div class="col-auto"> |
220 | 220 | <?php |
221 | - echo $this->renderSelect( |
|
222 | - $this->vars['status'], |
|
223 | - array( |
|
224 | - array( |
|
225 | - 'value' => '', |
|
226 | - 'label' => t('Status...') |
|
227 | - ), |
|
228 | - array( |
|
229 | - 'value' => 'untranslated', |
|
230 | - 'label' => t('Not translated') |
|
231 | - ), |
|
232 | - array( |
|
233 | - 'value' => 'translated', |
|
234 | - 'label' => t('Translated') |
|
235 | - ) |
|
236 | - ) |
|
237 | - ); |
|
221 | + echo $this->renderSelect( |
|
222 | + $this->vars['status'], |
|
223 | + array( |
|
224 | + array( |
|
225 | + 'value' => '', |
|
226 | + 'label' => t('Status...') |
|
227 | + ), |
|
228 | + array( |
|
229 | + 'value' => 'untranslated', |
|
230 | + 'label' => t('Not translated') |
|
231 | + ), |
|
232 | + array( |
|
233 | + 'value' => 'translated', |
|
234 | + 'label' => t('Translated') |
|
235 | + ) |
|
236 | + ) |
|
237 | + ); |
|
238 | 238 | |
239 | - echo $this->renderSelect( |
|
240 | - $this->vars['location'], |
|
241 | - array( |
|
242 | - array( |
|
243 | - 'value' => '', |
|
244 | - 'label' => t('Location...') |
|
245 | - ), |
|
246 | - array( |
|
247 | - 'value' => 'client', |
|
248 | - 'label' => t('Clientside') |
|
249 | - ), |
|
250 | - array( |
|
251 | - 'value' => 'server', |
|
252 | - 'label' => t('Serverside') |
|
253 | - ) |
|
254 | - ) |
|
255 | - ); |
|
256 | - ?> |
|
239 | + echo $this->renderSelect( |
|
240 | + $this->vars['location'], |
|
241 | + array( |
|
242 | + array( |
|
243 | + 'value' => '', |
|
244 | + 'label' => t('Location...') |
|
245 | + ), |
|
246 | + array( |
|
247 | + 'value' => 'client', |
|
248 | + 'label' => t('Clientside') |
|
249 | + ), |
|
250 | + array( |
|
251 | + 'value' => 'server', |
|
252 | + 'label' => t('Serverside') |
|
253 | + ) |
|
254 | + ) |
|
255 | + ); |
|
256 | + ?> |
|
257 | 257 | </div> |
258 | 258 | <div class="col-auto"> |
259 | 259 | <button type="submit" name="<?php echo $this->vars['filter'] ?>" value="yes" class="btn btn-primary mb-2" title="<?php pt('Filter the list with the selected criteria.') ?>" data-toggle="tooltip"> |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | </form> |
269 | 269 | <p> |
270 | 270 | <small class="text-muted"><?php |
271 | - pts('Hint:'); |
|
272 | - pt('Search works in translated and untranslated text, as well as the file name.') |
|
273 | - ?></small> |
|
271 | + pts('Hint:'); |
|
272 | + pt('Search works in translated and untranslated text, as well as the file name.') |
|
273 | + ?></small> |
|
274 | 274 | </p> |
275 | 275 | <br> |
276 | 276 | <?php |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | $this->editor = $editor; |
56 | 56 | $this->request = $editor->getRequest(); |
57 | 57 | |
58 | - foreach($this->vars as $var => $name) { |
|
58 | + foreach ($this->vars as $var => $name) { |
|
59 | 59 | $this->vars[$var] = $this->editor->getVarName($var); |
60 | 60 | } |
61 | 61 | |
62 | - if(!isset($_SESSION[$this->sessionName])) { |
|
62 | + if (!isset($_SESSION[$this->sessionName])) { |
|
63 | 63 | $_SESSION[$this->sessionName] = array(); |
64 | 64 | } |
65 | 65 | |
66 | - if($this->request->getBool($this->vars['resetfilter'])) |
|
66 | + if ($this->request->getBool($this->vars['resetfilter'])) |
|
67 | 67 | { |
68 | 68 | $defaults = $this->getDefaultValues(); |
69 | 69 | |
70 | - foreach($defaults as $name => $val) { |
|
70 | + foreach ($defaults as $name => $val) { |
|
71 | 71 | $this->setValue($name, $val); |
72 | 72 | } |
73 | 73 | } |
74 | - else if($this->request->getBool($this->vars['filter'])) |
|
74 | + else if ($this->request->getBool($this->vars['filter'])) |
|
75 | 75 | { |
76 | 76 | $this->parseSearchTerms($this->request->getParam($this->vars['search'])); |
77 | 77 | |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | |
107 | 107 | protected function getValue(string $filterName) : string |
108 | 108 | { |
109 | - if(isset($_SESSION[$this->sessionName][$filterName])) { |
|
109 | + if (isset($_SESSION[$this->sessionName][$filterName])) { |
|
110 | 110 | return $_SESSION[$this->sessionName][$filterName]; |
111 | 111 | } |
112 | 112 | |
113 | 113 | $defaults = $this->getDefaultValues(); |
114 | - if(isset($defaults[$filterName])) { |
|
114 | + if (isset($defaults[$filterName])) { |
|
115 | 115 | return $defaults[$filterName]; |
116 | 116 | } |
117 | 117 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | protected function parseSearchTerms(string $searchString) : void |
132 | 132 | { |
133 | - if(empty($searchString)) |
|
133 | + if (empty($searchString)) |
|
134 | 134 | { |
135 | 135 | $this->searchTerms = array(); |
136 | 136 | $this->searchString = ''; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $terms = array_map('trim', $terms); |
145 | 145 | |
146 | 146 | $keep = array(); |
147 | - foreach($terms as $term) { |
|
148 | - if(!empty($term)) { |
|
147 | + foreach ($terms as $term) { |
|
148 | + if (!empty($term)) { |
|
149 | 149 | $keep[] = $term; |
150 | 150 | } |
151 | 151 | } |
@@ -156,28 +156,28 @@ discard block |
||
156 | 156 | |
157 | 157 | public function isStringMatch(Localization_Scanner_StringHash $string) : bool |
158 | 158 | { |
159 | - if(!empty($this->searchTerms)) |
|
159 | + if (!empty($this->searchTerms)) |
|
160 | 160 | { |
161 | 161 | $haystack = $string->getSearchString(); |
162 | 162 | |
163 | - foreach($this->searchTerms as $term) { |
|
164 | - if(!mb_stristr($haystack, $term)) { |
|
163 | + foreach ($this->searchTerms as $term) { |
|
164 | + if (!mb_stristr($haystack, $term)) { |
|
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | $status = $this->getValue($this->vars['status']); |
171 | - if($status === 'untranslated' && $string->isTranslated()) { |
|
171 | + if ($status === 'untranslated' && $string->isTranslated()) { |
|
172 | 172 | return false; |
173 | - } else if($status === 'translated' && !$string->isTranslated()) { |
|
173 | + } else if ($status === 'translated' && !$string->isTranslated()) { |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $location = $this->getValue($this->vars['location']); |
178 | - if($location === 'client' && !$string->hasLanguageType('Javascript')) { |
|
178 | + if ($location === 'client' && !$string->hasLanguageType('Javascript')) { |
|
179 | 179 | return false; |
180 | - } else if($location === 'server' && !$string->hasLanguageType('PHP')) { |
|
180 | + } else if ($location === 'server' && !$string->hasLanguageType('PHP')) { |
|
181 | 181 | return false; |
182 | 182 | } |
183 | 183 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | <div class="form-hiddens"> |
206 | 206 | <?php |
207 | 207 | $params = $this->editor->getRequestParams(); |
208 | - foreach($params as $name => $value) { |
|
208 | + foreach ($params as $name => $value) { |
|
209 | 209 | ?> |
210 | 210 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
211 | 211 | <?php |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | ?> |
294 | 294 | <select class="form-control" name="<?php echo $filterName ?>"> |
295 | 295 | <?php |
296 | - foreach($entries as $entry) |
|
296 | + foreach ($entries as $entry) |
|
297 | 297 | { |
298 | 298 | $selected = ''; |
299 | - if($entry['value'] === $value) { |
|
299 | + if ($entry['value'] === $value) { |
|
300 | 300 | $selected = ' selected'; |
301 | 301 | } |
302 | 302 |
@@ -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) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | public function addHashes(array $hashes) : Localization_Writer |
70 | 70 | { |
71 | - foreach($hashes as $hash => $text) |
|
71 | + foreach ($hashes as $hash => $text) |
|
72 | 72 | { |
73 | 73 | $this->addHash($hash, $text); |
74 | 74 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $hashes = $this->compileHashes(); |
91 | 91 | $lines = array(); |
92 | 92 | |
93 | - foreach($hashes as $entry) |
|
93 | + foreach ($hashes as $entry) |
|
94 | 94 | { |
95 | 95 | $lines[] = sprintf( |
96 | 96 | '%s= "%s"', |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | |
107 | 107 | private function renderHead() : string |
108 | 108 | { |
109 | - $title = strtoupper($this->fileType).' TRANSLATION FILE FOR ' . strtoupper($this->locale->getLabel()); |
|
109 | + $title = strtoupper($this->fileType).' TRANSLATION FILE FOR '.strtoupper($this->locale->getLabel()); |
|
110 | 110 | |
111 | 111 | $lines = array(); |
112 | 112 | |
113 | 113 | $lines[] = '; -------------------------------------------------------'; |
114 | - $lines[] = '; '. $title; |
|
114 | + $lines[] = '; '.$title; |
|
115 | 115 | $lines[] = '; -------------------------------------------------------'; |
116 | 116 | $lines[] = '; '; |
117 | 117 | |
118 | - if($this->editable) |
|
118 | + if ($this->editable) |
|
119 | 119 | { |
120 | 120 | $lines[] = '; You may edit text directly in this file under the following conditions:'; |
121 | 121 | $lines[] = '; '; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | $hashes = array(); |
139 | 139 | |
140 | - foreach($this->hashes as $hash => $text) |
|
140 | + foreach ($this->hashes as $hash => $text) |
|
141 | 141 | { |
142 | 142 | $hashes[] = array( |
143 | 143 | 'hash' => $hash, |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | { |
165 | 165 | $result = strnatcasecmp($a['text'], $b['text']); |
166 | 166 | |
167 | - if($result === 0) |
|
167 | + if ($result === 0) |
|
168 | 168 | { |
169 | 169 | return strnatcmp($a['hash'], $b['hash']); |
170 | 170 | } |
@@ -121,8 +121,7 @@ |
||
121 | 121 | $lines[] = '; '; |
122 | 122 | $lines[] = '; 1) Do not to modify the keys (left hand side of the = sign)'; |
123 | 123 | $lines[] = '; 2) Save the file as UTF-8 without BOM'; |
124 | - } |
|
125 | - else |
|
124 | + } else |
|
126 | 125 | { |
127 | 126 | $lines[] = '; Do NOT edit this file directly! It depends on the main translation file'; |
128 | 127 | $lines[] = '; and any changes will be lost. Edit the main file instead.'; |
@@ -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']); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $texts = $language->getTexts(); |
108 | 108 | |
109 | - foreach($texts as $text) |
|
109 | + foreach ($texts as $text) |
|
110 | 110 | { |
111 | 111 | $this->collection->addFromFile( |
112 | 112 | $this->getID(), |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $warnings = $language->getWarnings(); |
120 | 120 | |
121 | - foreach($warnings as $warning) { |
|
121 | + foreach ($warnings as $warning) { |
|
122 | 122 | $this->collection->addWarning($warning); |
123 | 123 | } |
124 | 124 | } |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | $amount = 0; |
146 | 146 | |
147 | 147 | $hashes = $this->getHashes($scanner); |
148 | - foreach($hashes as $hash) { |
|
148 | + foreach ($hashes as $hash) { |
|
149 | 149 | $text = $translator->getHashTranslation($hash->getHash()); |
150 | - if(empty($text)) { |
|
150 | + if (empty($text)) { |
|
151 | 151 | $amount++; |
152 | 152 | } |
153 | 153 | } |
@@ -6,39 +6,39 @@ |
||
6 | 6 | |
7 | 7 | abstract class Localization_Source |
8 | 8 | { |
9 | - /** |
|
10 | - * Human-readable label for the source. |
|
11 | - * @var string |
|
12 | - */ |
|
9 | + /** |
|
10 | + * Human-readable label for the source. |
|
11 | + * @var string |
|
12 | + */ |
|
13 | 13 | protected $label; |
14 | 14 | |
15 | - /** |
|
16 | - * Human-readable group name to categorize the source. |
|
17 | - * @var string |
|
18 | - */ |
|
15 | + /** |
|
16 | + * Human-readable group name to categorize the source. |
|
17 | + * @var string |
|
18 | + */ |
|
19 | 19 | protected $group; |
20 | 20 | |
21 | - /** |
|
22 | - * The folder in which the localization files are stored |
|
23 | - * @var string |
|
24 | - */ |
|
21 | + /** |
|
22 | + * The folder in which the localization files are stored |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | protected $storageFolder; |
26 | 26 | |
27 | - /** |
|
28 | - * @var string |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var string |
|
29 | + */ |
|
30 | 30 | protected $alias; |
31 | 31 | |
32 | - /** |
|
33 | - * Available during scanning. |
|
34 | - * @var Localization_Scanner_StringsCollection|NULL |
|
35 | - */ |
|
32 | + /** |
|
33 | + * Available during scanning. |
|
34 | + * @var Localization_Scanner_StringsCollection|NULL |
|
35 | + */ |
|
36 | 36 | protected $collection; |
37 | 37 | |
38 | - /** |
|
39 | - * Available during scanning. |
|
40 | - * @var Localization_Parser|NULL |
|
41 | - */ |
|
38 | + /** |
|
39 | + * Available during scanning. |
|
40 | + * @var Localization_Parser|NULL |
|
41 | + */ |
|
42 | 42 | protected $parser; |
43 | 43 | |
44 | 44 | public function __construct(string $alias, string $label, string $group, string $storageFolder) |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | $ext = FileHelper::getExtension($path); |
105 | 105 | |
106 | - if($this->isExtensionSupported($ext)) { |
|
106 | + if ($this->isExtensionSupported($ext)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | $values = $this->getLanguageIDs(); |
128 | 128 | |
129 | - if(in_array($languageID, $values)) { |
|
129 | + if (in_array($languageID, $values)) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | $this->requireValidLanguageID($languageID); |
172 | 172 | |
173 | - if(!isset($this->languageParsers[$languageID])) |
|
173 | + if (!isset($this->languageParsers[$languageID])) |
|
174 | 174 | { |
175 | 175 | $this->languageParsers[$languageID] = $this->createLanguageInstance($languageID); |
176 | 176 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | $object = new $class($this); |
192 | 192 | |
193 | - if($object instanceof Localization_Parser_Language) |
|
193 | + if ($object instanceof Localization_Parser_Language) |
|
194 | 194 | { |
195 | 195 | return $object; |
196 | 196 | } |
@@ -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); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | private $hash; |
31 | 31 | |
32 | - public function __construct(string $text, int $line, string $explanation='') |
|
32 | + public function __construct(string $text, int $line, string $explanation = '') |
|
33 | 33 | { |
34 | 34 | $this->text = $text; |
35 | 35 | $this->line = $line; |
@@ -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 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function getProperty(string $name) : ?string |
89 | 89 | { |
90 | - if(isset($this->properties[$name])) { |
|
90 | + if (isset($this->properties[$name])) { |
|
91 | 91 | return $this->properties[$name]; |
92 | 92 | } |
93 | 93 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | Text::fromArray($array[self::SERIALIZED_TEXT]) |
142 | 142 | ); |
143 | 143 | |
144 | - foreach($array[self::SERIALIZED_PROPERTIES] as $name => $value) { |
|
144 | + foreach ($array[self::SERIALIZED_PROPERTIES] as $name => $value) { |
|
145 | 145 | $string->setProperty($name, $value); |
146 | 146 | } |
147 | 147 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $entries = array(); |
52 | 52 | |
53 | - foreach($this->strings as $string) { |
|
53 | + foreach ($this->strings as $string) { |
|
54 | 54 | $entries[] = $string->toArray(); |
55 | 55 | } |
56 | 56 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | { |
71 | 71 | $amount = 0; |
72 | 72 | |
73 | - foreach($this->strings as $string) { |
|
74 | - if($string->isFile()) { |
|
73 | + foreach ($this->strings as $string) { |
|
74 | + if ($string->isFile()) { |
|
75 | 75 | $amount++; |
76 | 76 | } |
77 | 77 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | |
87 | 87 | public function hasLanguageType(string $type) : bool |
88 | 88 | { |
89 | - foreach($this->strings as $string) { |
|
90 | - if($string->getLanguageType() == $type) { |
|
89 | + foreach ($this->strings as $string) { |
|
90 | + if ($string->getLanguageType() == $type) { |
|
91 | 91 | return true; |
92 | 92 | } |
93 | 93 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | public function getText() : ?Text |
99 | 99 | { |
100 | - if(isset($this->strings[0])) { |
|
100 | + if (isset($this->strings[0])) { |
|
101 | 101 | return $this->strings[0]->getText(); |
102 | 102 | } |
103 | 103 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $translator = Localization::getTranslator(); |
130 | 130 | $text = $translator->getHashTranslation($this->getHash()); |
131 | 131 | |
132 | - if($text !== null) { |
|
132 | + if ($text !== null) { |
|
133 | 133 | return $text; |
134 | 134 | } |
135 | 135 | |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | { |
145 | 145 | $files = array(); |
146 | 146 | |
147 | - foreach($this->strings as $string) |
|
147 | + foreach ($this->strings as $string) |
|
148 | 148 | { |
149 | - if(!$string->isFile()) { |
|
149 | + if (!$string->isFile()) { |
|
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $file = $string->getSourceFile(); |
154 | - if(!in_array($file, $files)) { |
|
154 | + if (!in_array($file, $files)) { |
|
155 | 155 | $files[] = $file; |
156 | 156 | } |
157 | 157 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $files = $this->getFiles(); |
171 | 171 | $result = array(); |
172 | 172 | |
173 | - foreach($files as $path) { |
|
173 | + foreach ($files as $path) { |
|
174 | 174 | $result[] = basename($path); |
175 | 175 | } |
176 | 176 |
@@ -15,19 +15,19 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | return $result; |
185 | 185 | } |
186 | 186 | |
187 | - /** |
|
188 | - * Retrieves a text comprised of all strings that are relevant |
|
189 | - * for a full text search, imploded together. Used in the search |
|
190 | - * function to find matching strings. |
|
191 | - * |
|
192 | - * @return string |
|
193 | - */ |
|
187 | + /** |
|
188 | + * Retrieves a text comprised of all strings that are relevant |
|
189 | + * for a full text search, imploded together. Used in the search |
|
190 | + * function to find matching strings. |
|
191 | + * |
|
192 | + * @return string |
|
193 | + */ |
|
194 | 194 | public function getSearchString() : string |
195 | 195 | { |
196 | 196 | $parts = array($this->getTranslatedText(), $this->getText()); |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | const EVENT_LOCALE_CHANGED = 'LocaleChanged'; |
49 | 49 | |
50 | 50 | /** |
51 | - * Collection of all locales by namespace (application, content, custom...). |
|
52 | - * |
|
53 | - * @var array<string,array<string,Localization_Locale>> |
|
54 | - * @see Localization::addLocale() |
|
55 | - */ |
|
51 | + * Collection of all locales by namespace (application, content, custom...). |
|
52 | + * |
|
53 | + * @var array<string,array<string,Localization_Locale>> |
|
54 | + * @see Localization::addLocale() |
|
55 | + */ |
|
56 | 56 | protected static $locales = array(); |
57 | 57 | |
58 | 58 | /** |
@@ -61,57 +61,57 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private static $initDone = false; |
63 | 63 | |
64 | - /** |
|
65 | - * Path to the file in which the scanner results are stored. |
|
66 | - * @var string |
|
67 | - * @see Localization::configure() |
|
68 | - */ |
|
64 | + /** |
|
65 | + * Path to the file in which the scanner results are stored. |
|
66 | + * @var string |
|
67 | + * @see Localization::configure() |
|
68 | + */ |
|
69 | 69 | protected static $storageFile = ''; |
70 | 70 | |
71 | - /** |
|
72 | - * Path to the folder into which the client libraries are written. |
|
73 | - * @var string |
|
74 | - * @see Localization::setClientLibrariesFolder() |
|
75 | - */ |
|
71 | + /** |
|
72 | + * Path to the folder into which the client libraries are written. |
|
73 | + * @var string |
|
74 | + * @see Localization::setClientLibrariesFolder() |
|
75 | + */ |
|
76 | 76 | protected static $clientFolder = ''; |
77 | 77 | |
78 | - /** |
|
79 | - * If this key changes, client libraries are refreshed. |
|
80 | - * @var string |
|
81 | - * @see Localization::setClientLibrariesCacheKey() |
|
82 | - */ |
|
78 | + /** |
|
79 | + * If this key changes, client libraries are refreshed. |
|
80 | + * @var string |
|
81 | + * @see Localization::setClientLibrariesCacheKey() |
|
82 | + */ |
|
83 | 83 | protected static $clientCacheKey = ''; |
84 | 84 | |
85 | - /** |
|
86 | - * Whether the configuration has been made. |
|
87 | - * @var bool |
|
88 | - * @see Localization::configure() |
|
89 | - */ |
|
85 | + /** |
|
86 | + * Whether the configuration has been made. |
|
87 | + * @var bool |
|
88 | + * @see Localization::configure() |
|
89 | + */ |
|
90 | 90 | protected static $configured = false; |
91 | 91 | |
92 | - /** |
|
93 | - * Stores event listener instances. |
|
94 | - * @var array |
|
95 | - */ |
|
92 | + /** |
|
93 | + * Stores event listener instances. |
|
94 | + * @var array |
|
95 | + */ |
|
96 | 96 | protected static $listeners = array(); |
97 | 97 | |
98 | - /** |
|
99 | - * @var integer |
|
100 | - * @see Localization::addEventListener() |
|
101 | - */ |
|
98 | + /** |
|
99 | + * @var integer |
|
100 | + * @see Localization::addEventListener() |
|
101 | + */ |
|
102 | 102 | protected static $listenersCounter = 0; |
103 | 103 | |
104 | - /** |
|
105 | - * @var Localization_Translator|NULL |
|
106 | - */ |
|
104 | + /** |
|
105 | + * @var Localization_Translator|NULL |
|
106 | + */ |
|
107 | 107 | protected static $translator; |
108 | 108 | |
109 | - /** |
|
110 | - * Initializes the localization layer. This is done |
|
111 | - * automatically, and only once per request. |
|
112 | - * |
|
113 | - * (Called at the end of this file) |
|
114 | - */ |
|
109 | + /** |
|
110 | + * Initializes the localization layer. This is done |
|
111 | + * automatically, and only once per request. |
|
112 | + * |
|
113 | + * (Called at the end of this file) |
|
114 | + */ |
|
115 | 115 | public static function init() : void |
116 | 116 | { |
117 | 117 | if(self::$initDone) { |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | return self::getLocalesByNS(self::NAMESPACE_APPLICATION); |
151 | 151 | } |
152 | 152 | |
153 | - /** |
|
154 | - * Retrieves all locales in the specified namespace. |
|
155 | - * |
|
156 | - * @param string $namespace |
|
157 | - * @return Localization_Locale[] |
|
158 | - */ |
|
153 | + /** |
|
154 | + * Retrieves all locales in the specified namespace. |
|
155 | + * |
|
156 | + * @param string $namespace |
|
157 | + * @return Localization_Locale[] |
|
158 | + */ |
|
159 | 159 | public static function getLocalesByNS(string $namespace) |
160 | 160 | { |
161 | 161 | if(isset(self::$locales[$namespace])) { |
@@ -172,35 +172,35 @@ discard block |
||
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - /** |
|
176 | - * Adds an application locale to use in the application. |
|
177 | - * |
|
178 | - * @param string $localeName |
|
179 | - * @return Localization_Locale |
|
180 | - */ |
|
175 | + /** |
|
176 | + * Adds an application locale to use in the application. |
|
177 | + * |
|
178 | + * @param string $localeName |
|
179 | + * @return Localization_Locale |
|
180 | + */ |
|
181 | 181 | public static function addAppLocale(string $localeName) : Localization_Locale |
182 | 182 | { |
183 | 183 | return self::addLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
184 | 184 | } |
185 | 185 | |
186 | - /** |
|
187 | - * Adds a content locale to use for content in the application. |
|
188 | - * |
|
189 | - * @param string $localeName |
|
190 | - * @return Localization_Locale |
|
191 | - */ |
|
186 | + /** |
|
187 | + * Adds a content locale to use for content in the application. |
|
188 | + * |
|
189 | + * @param string $localeName |
|
190 | + * @return Localization_Locale |
|
191 | + */ |
|
192 | 192 | public static function addContentLocale(string $localeName) : Localization_Locale |
193 | 193 | { |
194 | 194 | return self::addLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
195 | 195 | } |
196 | 196 | |
197 | - /** |
|
198 | - * Adds a locale to the specified namespace. |
|
199 | - * |
|
200 | - * @param string $localeName |
|
201 | - * @param string $namespace |
|
202 | - * @return Localization_Locale |
|
203 | - */ |
|
197 | + /** |
|
198 | + * Adds a locale to the specified namespace. |
|
199 | + * |
|
200 | + * @param string $localeName |
|
201 | + * @param string $namespace |
|
202 | + * @return Localization_Locale |
|
203 | + */ |
|
204 | 204 | public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
205 | 205 | { |
206 | 206 | if(!isset(self::$locales[$namespace])) { |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | return new $className(); |
243 | 243 | } |
244 | 244 | |
245 | - /** |
|
246 | - * Retrieves the currency of the selected app locale. |
|
247 | - * |
|
248 | - * @return Localization_Currency |
|
249 | - */ |
|
245 | + /** |
|
246 | + * Retrieves the currency of the selected app locale. |
|
247 | + * |
|
248 | + * @return Localization_Currency |
|
249 | + */ |
|
250 | 250 | public static function getAppCurrency() : Localization_Currency |
251 | 251 | { |
252 | 252 | return self::getCurrencyNS(self::NAMESPACE_APPLICATION); |
@@ -283,44 +283,44 @@ discard block |
||
283 | 283 | return self::getSelectedLocaleByNS(self::NAMESPACE_APPLICATION); |
284 | 284 | } |
285 | 285 | |
286 | - /** |
|
287 | - * Retrieves the name of the selected application locale. |
|
288 | - * |
|
289 | - * @return string |
|
290 | - */ |
|
286 | + /** |
|
287 | + * Retrieves the name of the selected application locale. |
|
288 | + * |
|
289 | + * @return string |
|
290 | + */ |
|
291 | 291 | public static function getAppLocaleName() : string |
292 | 292 | { |
293 | 293 | return self::getLocaleNameByNS(self::NAMESPACE_APPLICATION); |
294 | 294 | } |
295 | 295 | |
296 | - /** |
|
297 | - * Retrieves the names of the available application locales. |
|
298 | - * @return string[] |
|
299 | - */ |
|
296 | + /** |
|
297 | + * Retrieves the names of the available application locales. |
|
298 | + * @return string[] |
|
299 | + */ |
|
300 | 300 | public static function getAppLocaleNames() : array |
301 | 301 | { |
302 | 302 | return self::getLocaleNamesByNS(self::NAMESPACE_APPLICATION); |
303 | 303 | } |
304 | 304 | |
305 | - /** |
|
306 | - * Retrieves the selected locale name in the specified namespace. |
|
307 | - * |
|
308 | - * @param string $namespace |
|
309 | - * @throws Localization_Exception |
|
310 | - * @return string |
|
311 | - */ |
|
305 | + /** |
|
306 | + * Retrieves the selected locale name in the specified namespace. |
|
307 | + * |
|
308 | + * @param string $namespace |
|
309 | + * @throws Localization_Exception |
|
310 | + * @return string |
|
311 | + */ |
|
312 | 312 | public static function getLocaleNameByNS(string $namespace) : string |
313 | 313 | { |
314 | 314 | return self::getSelectedLocaleByNS($namespace)->getName(); |
315 | 315 | } |
316 | 316 | |
317 | - /** |
|
318 | - * Retrieves the selected locale instance for the specified namespace. |
|
319 | - * |
|
320 | - * @param string $namespace |
|
321 | - * @return Localization_Locale |
|
322 | - * @throws Localization_Exception |
|
323 | - */ |
|
317 | + /** |
|
318 | + * Retrieves the selected locale instance for the specified namespace. |
|
319 | + * |
|
320 | + * @param string $namespace |
|
321 | + * @return Localization_Locale |
|
322 | + * @throws Localization_Exception |
|
323 | + */ |
|
324 | 324 | public static function getSelectedLocaleByNS(string $namespace) : Localization_Locale |
325 | 325 | { |
326 | 326 | self::requireNamespace($namespace); |
@@ -339,24 +339,24 @@ discard block |
||
339 | 339 | ); |
340 | 340 | } |
341 | 341 | |
342 | - /** |
|
343 | - * Stores the selected locale names by namespace. |
|
344 | - * @var array<string,Localization_Locale> |
|
345 | - */ |
|
342 | + /** |
|
343 | + * Stores the selected locale names by namespace. |
|
344 | + * @var array<string,Localization_Locale> |
|
345 | + */ |
|
346 | 346 | protected static $selected = array(); |
347 | 347 | |
348 | - /** |
|
349 | - * Selects the active locale for the specified namespace. |
|
350 | - * |
|
351 | - * NOTE: Triggers the "LocaleChanged" event. |
|
352 | - * |
|
353 | - * @param string $localeName |
|
354 | - * @param string $namespace |
|
355 | - * @return Localization_Locale |
|
356 | - * @throws Localization_Exception |
|
357 | - * |
|
358 | - * @see Localization_Event_LocaleChanged |
|
359 | - */ |
|
348 | + /** |
|
349 | + * Selects the active locale for the specified namespace. |
|
350 | + * |
|
351 | + * NOTE: Triggers the "LocaleChanged" event. |
|
352 | + * |
|
353 | + * @param string $localeName |
|
354 | + * @param string $namespace |
|
355 | + * @return Localization_Locale |
|
356 | + * @throws Localization_Exception |
|
357 | + * |
|
358 | + * @see Localization_Event_LocaleChanged |
|
359 | + */ |
|
360 | 360 | public static function selectLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
361 | 361 | { |
362 | 362 | self::requireNamespace($namespace); |
@@ -487,15 +487,15 @@ discard block |
||
487 | 487 | return self::selectLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
488 | 488 | } |
489 | 489 | |
490 | - /** |
|
491 | - * Retrieves an application locale by its name. |
|
492 | - * Note that the locale must have been added first. |
|
493 | - * |
|
494 | - * @param string $localeName |
|
495 | - * @throws Localization_Exception |
|
496 | - * @return Localization_Locale |
|
497 | - * @see Localization::appLocaleExists() |
|
498 | - */ |
|
490 | + /** |
|
491 | + * Retrieves an application locale by its name. |
|
492 | + * Note that the locale must have been added first. |
|
493 | + * |
|
494 | + * @param string $localeName |
|
495 | + * @throws Localization_Exception |
|
496 | + * @return Localization_Locale |
|
497 | + * @see Localization::appLocaleExists() |
|
498 | + */ |
|
499 | 499 | public static function getAppLocaleByName(string $localeName) : Localization_Locale |
500 | 500 | { |
501 | 501 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_APPLICATION); |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | return self::getLocalesByNS(self::NAMESPACE_CONTENT); |
531 | 531 | } |
532 | 532 | |
533 | - /** |
|
534 | - * Retrieves the names of all content locales that have been added. |
|
535 | - * @return string[] |
|
536 | - */ |
|
533 | + /** |
|
534 | + * Retrieves the names of all content locales that have been added. |
|
535 | + * @return string[] |
|
536 | + */ |
|
537 | 537 | public static function getContentLocaleNames() |
538 | 538 | { |
539 | 539 | return self::getLocaleNamesByNS(self::NAMESPACE_CONTENT); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | sort($names); |
557 | 557 | |
558 | 558 | return $names; |
559 | - } |
|
559 | + } |
|
560 | 560 | |
561 | 561 | /** |
562 | 562 | * Checks by the locale name if the specified locale is |
@@ -585,14 +585,14 @@ discard block |
||
585 | 585 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_CONTENT); |
586 | 586 | } |
587 | 587 | |
588 | - /** |
|
589 | - * Retrieves a locale by its name in the specified namespace. |
|
590 | - * |
|
591 | - * @param string $localeName |
|
592 | - * @param string $namespace |
|
593 | - * @throws Localization_Exception |
|
594 | - * @return Localization_Locale |
|
595 | - */ |
|
588 | + /** |
|
589 | + * Retrieves a locale by its name in the specified namespace. |
|
590 | + * |
|
591 | + * @param string $localeName |
|
592 | + * @param string $namespace |
|
593 | + * @throws Localization_Exception |
|
594 | + * @return Localization_Locale |
|
595 | + */ |
|
596 | 596 | public static function getLocaleByNameNS(string $localeName, string $namespace) : Localization_Locale |
597 | 597 | { |
598 | 598 | self::requireNamespace($namespace); |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | return self::selectLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
664 | 664 | } |
665 | 665 | |
666 | - /** |
|
667 | - * Checks whether the localization has been configured entirely. |
|
668 | - * @return bool |
|
669 | - */ |
|
666 | + /** |
|
667 | + * Checks whether the localization has been configured entirely. |
|
668 | + * @return bool |
|
669 | + */ |
|
670 | 670 | public static function isConfigured() : bool |
671 | 671 | { |
672 | 672 | return self::$configured; |
@@ -738,29 +738,29 @@ discard block |
||
738 | 738 | ); |
739 | 739 | } |
740 | 740 | |
741 | - /** |
|
742 | - * Injects a content locales selector element into the specified |
|
743 | - * HTML QuickForm2 container. |
|
744 | - * |
|
745 | - * @param string $elementName |
|
746 | - * @param HTML_QuickForm2_Container $container |
|
747 | - * @param string $label |
|
748 | - * @return HTML_QuickForm2_Element_Select |
|
749 | - */ |
|
741 | + /** |
|
742 | + * Injects a content locales selector element into the specified |
|
743 | + * HTML QuickForm2 container. |
|
744 | + * |
|
745 | + * @param string $elementName |
|
746 | + * @param HTML_QuickForm2_Container $container |
|
747 | + * @param string $label |
|
748 | + * @return HTML_QuickForm2_Element_Select |
|
749 | + */ |
|
750 | 750 | public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
751 | 751 | { |
752 | 752 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label); |
753 | 753 | } |
754 | 754 | |
755 | - /** |
|
756 | - * Injects an app locales selector element into the specified |
|
755 | + /** |
|
756 | + * Injects an app locales selector element into the specified |
|
757 | 757 | * HTML QuickForm2 container. |
758 | 758 | * |
759 | - * @param string $elementName |
|
760 | - * @param HTML_QuickForm2_Container $container |
|
761 | - * @param string $label |
|
762 | - * @return HTML_QuickForm2_Element_Select |
|
763 | - */ |
|
759 | + * @param string $elementName |
|
760 | + * @param HTML_QuickForm2_Container $container |
|
761 | + * @param string $label |
|
762 | + * @return HTML_QuickForm2_Element_Select |
|
763 | + */ |
|
764 | 764 | public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
765 | 765 | { |
766 | 766 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label); |
@@ -796,26 +796,26 @@ discard block |
||
796 | 796 | return $select; |
797 | 797 | } |
798 | 798 | |
799 | - /** |
|
800 | - * @var Localization_Source[] |
|
801 | - */ |
|
799 | + /** |
|
800 | + * @var Localization_Source[] |
|
801 | + */ |
|
802 | 802 | protected static $sources = array(); |
803 | 803 | |
804 | - /** |
|
805 | - * @var string[] |
|
806 | - */ |
|
804 | + /** |
|
805 | + * @var string[] |
|
806 | + */ |
|
807 | 807 | protected static $excludeFolders = array(); |
808 | 808 | |
809 | - /** |
|
810 | - * @var string[] |
|
811 | - */ |
|
809 | + /** |
|
810 | + * @var string[] |
|
811 | + */ |
|
812 | 812 | protected static $excludeFiles = array(); |
813 | 813 | |
814 | - /** |
|
815 | - * Retrieves all currently available sources. |
|
816 | - * |
|
817 | - * @return Localization_Source[] |
|
818 | - */ |
|
814 | + /** |
|
815 | + * Retrieves all currently available sources. |
|
816 | + * |
|
817 | + * @return Localization_Source[] |
|
818 | + */ |
|
819 | 819 | public static function getSources() : array |
820 | 820 | { |
821 | 821 | return self::$sources; |
@@ -847,10 +847,10 @@ discard block |
||
847 | 847 | return $source; |
848 | 848 | } |
849 | 849 | |
850 | - /** |
|
851 | - * Retrieves all sources grouped by their group name. |
|
852 | - * @return array |
|
853 | - */ |
|
850 | + /** |
|
851 | + * Retrieves all sources grouped by their group name. |
|
852 | + * @return array |
|
853 | + */ |
|
854 | 854 | public static function getSourcesGrouped() |
855 | 855 | { |
856 | 856 | $sources = self::getSources(); |
@@ -871,11 +871,11 @@ discard block |
||
871 | 871 | return $grouped; |
872 | 872 | } |
873 | 873 | |
874 | - /** |
|
875 | - * Checks whether a specific source exists by its ID. |
|
876 | - * @param string $sourceID |
|
877 | - * @return boolean |
|
878 | - */ |
|
874 | + /** |
|
875 | + * Checks whether a specific source exists by its ID. |
|
876 | + * @param string $sourceID |
|
877 | + * @return boolean |
|
878 | + */ |
|
879 | 879 | public static function sourceExists(string $sourceID) : bool |
880 | 880 | { |
881 | 881 | $sources = self::getSources(); |
@@ -888,11 +888,11 @@ discard block |
||
888 | 888 | return false; |
889 | 889 | } |
890 | 890 | |
891 | - /** |
|
892 | - * Checks whether a specific source exists by its alias. |
|
893 | - * @param string $sourceAlias |
|
894 | - * @return boolean |
|
895 | - */ |
|
891 | + /** |
|
892 | + * Checks whether a specific source exists by its alias. |
|
893 | + * @param string $sourceAlias |
|
894 | + * @return boolean |
|
895 | + */ |
|
896 | 896 | public static function sourceAliasExists(string $sourceAlias) : bool |
897 | 897 | { |
898 | 898 | $sources = self::getSources(); |
@@ -905,13 +905,13 @@ discard block |
||
905 | 905 | return false; |
906 | 906 | } |
907 | 907 | |
908 | - /** |
|
909 | - * Retrieves a localization source by its ID. |
|
910 | - * |
|
911 | - * @param string $sourceID |
|
912 | - * @throws Localization_Exception |
|
913 | - * @return Localization_Source |
|
914 | - */ |
|
908 | + /** |
|
909 | + * Retrieves a localization source by its ID. |
|
910 | + * |
|
911 | + * @param string $sourceID |
|
912 | + * @throws Localization_Exception |
|
913 | + * @return Localization_Source |
|
914 | + */ |
|
915 | 915 | public static function getSourceByID(string $sourceID) : Localization_Source |
916 | 916 | { |
917 | 917 | $sources = self::getSources(); |
@@ -976,14 +976,14 @@ discard block |
||
976 | 976 | // FIXME: TODO: Add this |
977 | 977 | } |
978 | 978 | |
979 | - /** |
|
980 | - * Configures the localization for the application: |
|
981 | - * sets the location of the required files and folders. |
|
982 | - * Also updated the client library files as needed. |
|
983 | - * |
|
984 | - * @param string $storageFile Where to store the file analysis storage file. |
|
985 | - * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created. |
|
986 | - */ |
|
979 | + /** |
|
980 | + * Configures the localization for the application: |
|
981 | + * sets the location of the required files and folders. |
|
982 | + * Also updated the client library files as needed. |
|
983 | + * |
|
984 | + * @param string $storageFile Where to store the file analysis storage file. |
|
985 | + * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created. |
|
986 | + */ |
|
987 | 987 | public static function configure(string $storageFile, string $clientLibrariesFolder='') : void |
988 | 988 | { |
989 | 989 | self::$configured = true; |
@@ -999,17 +999,17 @@ discard block |
||
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | |
1002 | - /** |
|
1003 | - * Sets a key that is used to verify whether the client |
|
1004 | - * libraries have to be refreshed. A common use is to set |
|
1005 | - * this to the application's version number to guarantee |
|
1006 | - * new texts are automatically used with each release. |
|
1007 | - * |
|
1008 | - * NOTE: Otherwise files are refreshed only when saving |
|
1009 | - * them in the editor UI. |
|
1010 | - * |
|
1011 | - * @param string $key |
|
1012 | - */ |
|
1002 | + /** |
|
1003 | + * Sets a key that is used to verify whether the client |
|
1004 | + * libraries have to be refreshed. A common use is to set |
|
1005 | + * this to the application's version number to guarantee |
|
1006 | + * new texts are automatically used with each release. |
|
1007 | + * |
|
1008 | + * NOTE: Otherwise files are refreshed only when saving |
|
1009 | + * them in the editor UI. |
|
1010 | + * |
|
1011 | + * @param string $key |
|
1012 | + */ |
|
1013 | 1013 | public static function setClientLibrariesCacheKey(string $key) : void |
1014 | 1014 | { |
1015 | 1015 | self::$clientCacheKey = $key; |
@@ -1020,23 +1020,23 @@ discard block |
||
1020 | 1020 | return self::$clientCacheKey; |
1021 | 1021 | } |
1022 | 1022 | |
1023 | - /** |
|
1024 | - * Sets the folder where client libraries are to be stored. |
|
1025 | - * @param string $folder |
|
1026 | - */ |
|
1023 | + /** |
|
1024 | + * Sets the folder where client libraries are to be stored. |
|
1025 | + * @param string $folder |
|
1026 | + */ |
|
1027 | 1027 | public static function setClientLibrariesFolder(string $folder) : void |
1028 | 1028 | { |
1029 | 1029 | self::$clientFolder = $folder; |
1030 | 1030 | } |
1031 | 1031 | |
1032 | - /** |
|
1033 | - * Retrieves the path to the folder in which the client |
|
1034 | - * libraries should be stored. |
|
1035 | - * |
|
1036 | - * NOTE: Can return an empty string, when this is disabled. |
|
1037 | - * |
|
1038 | - * @return string |
|
1039 | - */ |
|
1032 | + /** |
|
1033 | + * Retrieves the path to the folder in which the client |
|
1034 | + * libraries should be stored. |
|
1035 | + * |
|
1036 | + * NOTE: Can return an empty string, when this is disabled. |
|
1037 | + * |
|
1038 | + * @return string |
|
1039 | + */ |
|
1040 | 1040 | public static function getClientLibrariesFolder() : string |
1041 | 1041 | { |
1042 | 1042 | return self::$clientFolder; |
@@ -1056,13 +1056,13 @@ discard block |
||
1056 | 1056 | self::createGenerator()->writeFiles($force); |
1057 | 1057 | } |
1058 | 1058 | |
1059 | - /** |
|
1060 | - * Creates a new instance of the client generator class |
|
1061 | - * that is used to write the localization files into the |
|
1062 | - * target folder on disk. |
|
1063 | - * |
|
1064 | - * @return Localization_ClientGenerator |
|
1065 | - */ |
|
1059 | + /** |
|
1060 | + * Creates a new instance of the client generator class |
|
1061 | + * that is used to write the localization files into the |
|
1062 | + * target folder on disk. |
|
1063 | + * |
|
1064 | + * @return Localization_ClientGenerator |
|
1065 | + */ |
|
1066 | 1066 | public static function createGenerator() : Localization_ClientGenerator |
1067 | 1067 | { |
1068 | 1068 | return new Localization_ClientGenerator(); |
@@ -1127,10 +1127,10 @@ discard block |
||
1127 | 1127 | return new Localization_Editor(); |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - /** |
|
1131 | - * Retrieves a list of all available source IDs. |
|
1132 | - * @return string[] |
|
1133 | - */ |
|
1130 | + /** |
|
1131 | + * Retrieves a list of all available source IDs. |
|
1132 | + * @return string[] |
|
1133 | + */ |
|
1134 | 1134 | public static function getSourceIDs() : array |
1135 | 1135 | { |
1136 | 1136 | $ids = array(); |
@@ -1157,9 +1157,9 @@ discard block |
||
1157 | 1157 | return $aliases; |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - /** |
|
1161 | - * Resets all locales to the built-in locale. |
|
1162 | - */ |
|
1160 | + /** |
|
1161 | + * Resets all locales to the built-in locale. |
|
1162 | + */ |
|
1163 | 1163 | public static function reset() : void |
1164 | 1164 | { |
1165 | 1165 | self::$locales = array(); |
@@ -1191,22 +1191,22 @@ discard block |
||
1191 | 1191 | 'de_CH' |
1192 | 1192 | ); |
1193 | 1193 | |
1194 | - /** |
|
1195 | - * Retrieves a list of all supported locales. |
|
1196 | - * |
|
1197 | - * @return string[] |
|
1198 | - */ |
|
1194 | + /** |
|
1195 | + * Retrieves a list of all supported locales. |
|
1196 | + * |
|
1197 | + * @return string[] |
|
1198 | + */ |
|
1199 | 1199 | public static function getSupportedLocaleNames() : array |
1200 | 1200 | { |
1201 | 1201 | return self::$supportedLocales; |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - /** |
|
1205 | - * Checks whether the specified locale is supported. |
|
1206 | - * |
|
1207 | - * @param string $localeName |
|
1208 | - * @return bool |
|
1209 | - */ |
|
1204 | + /** |
|
1205 | + * Checks whether the specified locale is supported. |
|
1206 | + * |
|
1207 | + * @param string $localeName |
|
1208 | + * @return bool |
|
1209 | + */ |
|
1210 | 1210 | public static function isLocaleSupported(string $localeName) : bool |
1211 | 1211 | { |
1212 | 1212 | return in_array($localeName, self::$supportedLocales); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function init() : void |
116 | 116 | { |
117 | - if(self::$initDone) { |
|
117 | + if (self::$initDone) { |
|
118 | 118 | return; |
119 | 119 | } |
120 | 120 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public static function getLocalesByNS(string $namespace) |
160 | 160 | { |
161 | - if(isset(self::$locales[$namespace])) { |
|
161 | + if (isset(self::$locales[$namespace])) { |
|
162 | 162 | return array_values(self::$locales[$namespace]); |
163 | 163 | } |
164 | 164 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
205 | 205 | { |
206 | - if(!isset(self::$locales[$namespace])) { |
|
206 | + if (!isset(self::$locales[$namespace])) { |
|
207 | 207 | self::$locales[$namespace] = array(); |
208 | 208 | } |
209 | 209 | |
210 | - if(!isset(self::$locales[$namespace][$localeName])) |
|
210 | + if (!isset(self::$locales[$namespace][$localeName])) |
|
211 | 211 | { |
212 | 212 | self::$locales[$namespace][$localeName] = self::createLocale($localeName); |
213 | 213 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public static function createCountry(string $id) |
240 | 240 | { |
241 | - $className = '\AppLocalize\Localization_Country_' . strtoupper($id); |
|
241 | + $className = '\AppLocalize\Localization_Country_'.strtoupper($id); |
|
242 | 242 | return new $className(); |
243 | 243 | } |
244 | 244 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | { |
326 | 326 | self::requireNamespace($namespace); |
327 | 327 | |
328 | - if(isset(self::$selected[$namespace])) { |
|
328 | + if (isset(self::$selected[$namespace])) { |
|
329 | 329 | return self::$selected[$namespace]; |
330 | 330 | } |
331 | 331 | |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | $locale = self::addLocaleByNS($localeName, $namespace); |
365 | 365 | $previous = null; |
366 | 366 | |
367 | - if(isset(self::$selected[$namespace])) |
|
367 | + if (isset(self::$selected[$namespace])) |
|
368 | 368 | { |
369 | - if(self::$selected[$namespace]->getName() === $localeName) { |
|
369 | + if (self::$selected[$namespace]->getName() === $localeName) { |
|
370 | 370 | return $locale; |
371 | 371 | } |
372 | 372 | |
@@ -402,11 +402,11 @@ discard block |
||
402 | 402 | $class = Localization_Event::class.'_'.$name; |
403 | 403 | $event = new $class($argsList); |
404 | 404 | |
405 | - if(!isset(self::$listeners[$name])) { |
|
405 | + if (!isset(self::$listeners[$name])) { |
|
406 | 406 | return $event; |
407 | 407 | } |
408 | 408 | |
409 | - foreach(self::$listeners[$name] as $listener) |
|
409 | + foreach (self::$listeners[$name] as $listener) |
|
410 | 410 | { |
411 | 411 | $callArgs = $listener['args']; |
412 | 412 | array_unshift($callArgs, $event); |
@@ -428,15 +428,15 @@ discard block |
||
428 | 428 | * @throws Localization_Exception |
429 | 429 | * @see \AppLocalize\Localization::ERROR_UNKNOWN_EVENT_NAME |
430 | 430 | */ |
431 | - public static function addEventListener(string $eventName, $callback, array $args=array()) : int |
|
431 | + public static function addEventListener(string $eventName, $callback, array $args = array()) : int |
|
432 | 432 | { |
433 | - if(!isset(self::$listeners[$eventName])) { |
|
433 | + if (!isset(self::$listeners[$eventName])) { |
|
434 | 434 | self::$listeners[$eventName] = array(); |
435 | 435 | } |
436 | 436 | |
437 | 437 | $className = Localization_Event::class.'_'.$eventName; |
438 | 438 | |
439 | - if(!class_exists($className)) |
|
439 | + if (!class_exists($className)) |
|
440 | 440 | { |
441 | 441 | throw new Localization_Exception( |
442 | 442 | sprintf('Unknown localization event [%s].', $eventName), |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @throws Localization_Exception |
471 | 471 | * @see Localization_Event_LocaleChanged |
472 | 472 | */ |
473 | - public static function onLocaleChanged($callback, array $args=array()) : int |
|
473 | + public static function onLocaleChanged($callback, array $args = array()) : int |
|
474 | 474 | { |
475 | 475 | return self::addEventListener(self::EVENT_LOCALE_CHANGED, $callback, $args); |
476 | 476 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | { |
598 | 598 | self::requireNamespace($namespace); |
599 | 599 | |
600 | - if(isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) { |
|
600 | + if (isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) { |
|
601 | 601 | return self::$locales[$namespace][$localeName]; |
602 | 602 | } |
603 | 603 | |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | * @param Localization_Locale|null $locale |
677 | 677 | * @return Localization_Translator |
678 | 678 | */ |
679 | - public static function getTranslator(?Localization_Locale $locale=null) : Localization_Translator |
|
679 | + public static function getTranslator(?Localization_Locale $locale = null) : Localization_Translator |
|
680 | 680 | { |
681 | - if($locale !== null) |
|
681 | + if ($locale !== null) |
|
682 | 682 | { |
683 | 683 | $obj = new Localization_Translator(); |
684 | 684 | $obj->addSources(self::getSources()); |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | return $obj; |
687 | 687 | } |
688 | 688 | |
689 | - if(!isset(self::$translator)) |
|
689 | + if (!isset(self::$translator)) |
|
690 | 690 | { |
691 | 691 | $obj = new Localization_Translator(); |
692 | 692 | $obj->addSources(self::getSources()); |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | { |
712 | 712 | self::requireNamespace($namespace); |
713 | 713 | |
714 | - if(isset(self::$locales[$namespace])) { |
|
714 | + if (isset(self::$locales[$namespace])) { |
|
715 | 715 | return count(self::$locales[$namespace]); |
716 | 716 | } |
717 | 717 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | */ |
725 | 725 | protected static function requireNamespace(string $namespace) : void |
726 | 726 | { |
727 | - if(isset(self::$locales[$namespace])) { |
|
727 | + if (isset(self::$locales[$namespace])) { |
|
728 | 728 | return; |
729 | 729 | } |
730 | 730 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * @param string $label |
748 | 748 | * @return HTML_QuickForm2_Element_Select |
749 | 749 | */ |
750 | - public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
|
750 | + public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select |
|
751 | 751 | { |
752 | 752 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label); |
753 | 753 | } |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | * @param string $label |
762 | 762 | * @return HTML_QuickForm2_Element_Select |
763 | 763 | */ |
764 | - public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
|
764 | + public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select |
|
765 | 765 | { |
766 | 766 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label); |
767 | 767 | } |
@@ -778,9 +778,9 @@ discard block |
||
778 | 778 | * @return HTML_QuickForm2_Element_Select |
779 | 779 | * @throws Localization_Exception |
780 | 780 | */ |
781 | - public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
|
781 | + public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select |
|
782 | 782 | { |
783 | - if(empty($label)) { |
|
783 | + if (empty($label)) { |
|
784 | 784 | $label = t('Language'); |
785 | 785 | } |
786 | 786 | |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | |
790 | 790 | $locales = self::getLocalesByNS($namespace); |
791 | 791 | |
792 | - foreach($locales as $locale) { |
|
792 | + foreach ($locales as $locale) { |
|
793 | 793 | $select->addOption($locale->getLabel(), $locale->getName()); |
794 | 794 | } |
795 | 795 | |
@@ -823,14 +823,14 @@ discard block |
||
823 | 823 | |
824 | 824 | public static function addExcludeFolder(string $folderName) : void |
825 | 825 | { |
826 | - if(!in_array($folderName, self::$excludeFolders)) { |
|
826 | + if (!in_array($folderName, self::$excludeFolders)) { |
|
827 | 827 | self::$excludeFolders[] = $folderName; |
828 | 828 | } |
829 | 829 | } |
830 | 830 | |
831 | 831 | public static function addExcludeFile(string $fileName) : void |
832 | 832 | { |
833 | - if(!in_array($fileName, self::$excludeFiles)) { |
|
833 | + if (!in_array($fileName, self::$excludeFiles)) { |
|
834 | 834 | self::$excludeFiles[] = $fileName; |
835 | 835 | } |
836 | 836 | } |
@@ -857,11 +857,11 @@ discard block |
||
857 | 857 | |
858 | 858 | $grouped = array(); |
859 | 859 | |
860 | - foreach($sources as $source) |
|
860 | + foreach ($sources as $source) |
|
861 | 861 | { |
862 | 862 | $group = $source->getGroup(); |
863 | 863 | |
864 | - if(!isset($grouped[$group])) { |
|
864 | + if (!isset($grouped[$group])) { |
|
865 | 865 | $grouped[$group] = array(); |
866 | 866 | } |
867 | 867 | |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | public static function sourceExists(string $sourceID) : bool |
880 | 880 | { |
881 | 881 | $sources = self::getSources(); |
882 | - foreach($sources as $source) { |
|
883 | - if($source->getID() == $sourceID) { |
|
882 | + foreach ($sources as $source) { |
|
883 | + if ($source->getID() == $sourceID) { |
|
884 | 884 | return true; |
885 | 885 | } |
886 | 886 | } |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | public static function sourceAliasExists(string $sourceAlias) : bool |
897 | 897 | { |
898 | 898 | $sources = self::getSources(); |
899 | - foreach($sources as $source) { |
|
900 | - if($source->getAlias() == $sourceAlias) { |
|
899 | + foreach ($sources as $source) { |
|
900 | + if ($source->getAlias() == $sourceAlias) { |
|
901 | 901 | return true; |
902 | 902 | } |
903 | 903 | } |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | public static function getSourceByID(string $sourceID) : Localization_Source |
916 | 916 | { |
917 | 917 | $sources = self::getSources(); |
918 | - foreach($sources as $source) { |
|
919 | - if($source->getID() == $sourceID) { |
|
918 | + foreach ($sources as $source) { |
|
919 | + if ($source->getID() == $sourceID) { |
|
920 | 920 | return $source; |
921 | 921 | } |
922 | 922 | } |
@@ -941,8 +941,8 @@ discard block |
||
941 | 941 | public static function getSourceByAlias(string $sourceAlias) : Localization_Source |
942 | 942 | { |
943 | 943 | $sources = self::getSources(); |
944 | - foreach($sources as $source) { |
|
945 | - if($source->getAlias() == $sourceAlias) { |
|
944 | + foreach ($sources as $source) { |
|
945 | + if ($source->getAlias() == $sourceAlias) { |
|
946 | 946 | return $source; |
947 | 947 | } |
948 | 948 | } |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | * @param string $storageFile Where to store the file analysis storage file. |
985 | 985 | * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created. |
986 | 986 | */ |
987 | - public static function configure(string $storageFile, string $clientLibrariesFolder='') : void |
|
987 | + public static function configure(string $storageFile, string $clientLibrariesFolder = '') : void |
|
988 | 988 | { |
989 | 989 | self::$configured = true; |
990 | 990 | |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | |
994 | 994 | // only write the client libraries to disk if the folder |
995 | 995 | // has been specified. |
996 | - if(!empty($clientLibrariesFolder)) |
|
996 | + if (!empty($clientLibrariesFolder)) |
|
997 | 997 | { |
998 | 998 | self::writeClientFiles(); |
999 | 999 | } |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | * @throws Localization_Exception |
1052 | 1052 | * @see Localization_ClientGenerator |
1053 | 1053 | */ |
1054 | - public static function writeClientFiles(bool $force=false) : void |
|
1054 | + public static function writeClientFiles(bool $force = false) : void |
|
1055 | 1055 | { |
1056 | 1056 | self::createGenerator()->writeFiles($force); |
1057 | 1057 | } |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | */ |
1085 | 1085 | protected static function requireConfiguration() : void |
1086 | 1086 | { |
1087 | - if(!self::$configured) |
|
1087 | + if (!self::$configured) |
|
1088 | 1088 | { |
1089 | 1089 | throw new Localization_Exception( |
1090 | 1090 | 'The localization configuration is incomplete.', |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | ); |
1094 | 1094 | } |
1095 | 1095 | |
1096 | - if(empty(self::$storageFile)) |
|
1096 | + if (empty(self::$storageFile)) |
|
1097 | 1097 | { |
1098 | 1098 | throw new Localization_Exception( |
1099 | 1099 | 'No localization storage file set', |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | ); |
1103 | 1103 | } |
1104 | 1104 | |
1105 | - if(empty(self::$sources)) |
|
1105 | + if (empty(self::$sources)) |
|
1106 | 1106 | { |
1107 | 1107 | throw new Localization_Exception( |
1108 | 1108 | 'No source folders have been defined.', |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | { |
1136 | 1136 | $ids = array(); |
1137 | 1137 | |
1138 | - foreach(self::$sources as $source) { |
|
1138 | + foreach (self::$sources as $source) { |
|
1139 | 1139 | $ids[] = $source->getID(); |
1140 | 1140 | } |
1141 | 1141 | |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | { |
1151 | 1151 | $aliases = array(); |
1152 | 1152 | |
1153 | - foreach(self::$sources as $source) { |
|
1153 | + foreach (self::$sources as $source) { |
|
1154 | 1154 | $aliases[] = $source->getAlias(); |
1155 | 1155 | } |
1156 | 1156 |