@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | switch (strtoupper($cmd)) { |
316 | 316 | case '$BEGINBLOCK': |
317 | 317 | if (!$this->processBeginBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) { |
318 | - return false; |
|
319 | - } |
|
318 | + return false; |
|
319 | + } |
|
320 | 320 | break; |
321 | 321 | case '$ENDBLOCK': |
322 | 322 | if (!$this->processEndBlockCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) { |
323 | - return false; |
|
324 | - } |
|
323 | + return false; |
|
324 | + } |
|
325 | 325 | break; |
326 | 326 | case '$INCLUDE': |
327 | 327 | if (!$this->processincludeCmd($parms, $cmdTPosBegin, $cmdTPosEnd)) { |
328 | - return false; |
|
329 | - } |
|
328 | + return false; |
|
329 | + } |
|
330 | 330 | $resumeFromStart = true; |
331 | 331 | break; |
332 | 332 | default: |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | switch ($this->outputMode) { |
849 | 849 | case 0: // output to PHP output stream |
850 | 850 | if (!print($s)) { |
851 | - $this->outputError = true; |
|
852 | - } |
|
851 | + $this->outputError = true; |
|
852 | + } |
|
853 | 853 | break; |
854 | 854 | case 1: // output to file |
855 | 855 | $rc = fwrite($this->outputFileHandle, $s); |
@@ -26,14 +26,14 @@ |
||
26 | 26 | $config['DB_PORT'] = env('DB_PORT'); |
27 | 27 | if (empty($config['DB_TYPE'])) { |
28 | 28 | switch ($config['DB_PORT']) { |
29 | - case 3306: |
|
30 | - $config['DB_TYPE'] = 'mysql'; |
|
31 | - break; |
|
32 | - case 5432: |
|
33 | - $config['DB_TYPE'] = 'pgsql'; |
|
34 | - break; |
|
35 | - default: |
|
36 | - error('Database on non-standard port ' . $config['DB_PORT'] . ' and env DB_TYPE not present'); |
|
29 | + case 3306: |
|
30 | + $config['DB_TYPE'] = 'mysql'; |
|
31 | + break; |
|
32 | + case 5432: |
|
33 | + $config['DB_TYPE'] = 'pgsql'; |
|
34 | + break; |
|
35 | + default: |
|
36 | + error('Database on non-standard port ' . $config['DB_PORT'] . ' and env DB_TYPE not present'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | $eport = 3306; |
17 | 17 | } |
18 | 18 | if (!empty($eport)) { |
19 | - $config['DB_HOST'] = env('DB_PORT_' . $eport . '_TCP_ADDR'); |
|
20 | - $config['DB_PORT'] = env('DB_PORT_' . $eport . '_TCP_PORT'); |
|
19 | + $config['DB_HOST'] = env('DB_PORT_'.$eport.'_TCP_ADDR'); |
|
20 | + $config['DB_PORT'] = env('DB_PORT_'.$eport.'_TCP_PORT'); |
|
21 | 21 | } elseif (getenv('DB_PORT') === false) { |
22 | 22 | error('The env DB_PORT does not exist. Make sure to run with "--link mypostgresinstance:DB"'); |
23 | 23 | } elseif (is_numeric(getenv('DB_PORT')) && getenv('DB_HOST') !== false) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $config['DB_TYPE'] = 'pgsql'; |
34 | 34 | break; |
35 | 35 | default: |
36 | - error('Database on non-standard port ' . $config['DB_PORT'] . ' and env DB_TYPE not present'); |
|
36 | + error('Database on non-standard port '.$config['DB_PORT'].' and env DB_TYPE not present'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $config['DB_USER'] = env('DB_USER', $config['DB_NAME']); |
46 | 46 | $config['DB_PASS'] = env('DB_PASS', $config['DB_USER']); |
47 | 47 | if (!dbcheck($config)) { |
48 | - echo 'Database login failed, trying to create...' . PHP_EOL; |
|
48 | + echo 'Database login failed, trying to create...'.PHP_EOL; |
|
49 | 49 | // superuser account to create new database and corresponding user account |
50 | 50 | // username (SU_USER) can be supplied or defaults to "docker" |
51 | 51 | // password (SU_PASS) can be supplied or defaults to username |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | $super['DB_PASS'] = env('DB_ENV_PASS', $super['DB_USER']); |
56 | 56 | $pdo = dbconnect($super); |
57 | 57 | if ($super['DB_TYPE'] === 'mysql') { |
58 | - $pdo->exec('CREATE DATABASE ' . ($config['DB_NAME'])); |
|
59 | - $pdo->exec('GRANT ALL PRIVILEGES ON ' . ($config['DB_NAME']) . '.* TO ' . $pdo->quote($config['DB_USER']) . '@"%" IDENTIFIED BY ' . $pdo->quote($config['DB_PASS'])); |
|
58 | + $pdo->exec('CREATE DATABASE '.($config['DB_NAME'])); |
|
59 | + $pdo->exec('GRANT ALL PRIVILEGES ON '.($config['DB_NAME']).'.* TO '.$pdo->quote($config['DB_USER']).'@"%" IDENTIFIED BY '.$pdo->quote($config['DB_PASS'])); |
|
60 | 60 | } else { |
61 | - $pdo->exec('CREATE ROLE ' . ($config['DB_USER']) . ' WITH LOGIN PASSWORD ' . $pdo->quote($config['DB_PASS'])); |
|
62 | - $pdo->exec('CREATE DATABASE ' . ($config['DB_NAME']) . ' WITH OWNER ' . ($config['DB_USER'])); |
|
61 | + $pdo->exec('CREATE ROLE '.($config['DB_USER']).' WITH LOGIN PASSWORD '.$pdo->quote($config['DB_PASS'])); |
|
62 | + $pdo->exec('CREATE DATABASE '.($config['DB_NAME']).' WITH OWNER '.($config['DB_USER'])); |
|
63 | 63 | } |
64 | 64 | unset($pdo); |
65 | 65 | if (dbcheck($config)) { |
66 | - echo 'Database login created and confirmed' . PHP_EOL; |
|
66 | + echo 'Database login created and confirmed'.PHP_EOL; |
|
67 | 67 | } else { |
68 | 68 | error('Database login failed, trying to create login failed as well'); |
69 | 69 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | // reached this point => table found, assume db is complete |
75 | 75 | } |
76 | 76 | catch (PDOException $e) { |
77 | - echo 'Database table not found, applying schema... ' . PHP_EOL; |
|
78 | - $schema = file_get_contents('schema/ttrss_schema_' . $config['DB_TYPE'] . '.sql'); |
|
77 | + echo 'Database table not found, applying schema... '.PHP_EOL; |
|
78 | + $schema = file_get_contents('schema/ttrss_schema_'.$config['DB_TYPE'].'.sql'); |
|
79 | 79 | $schema = preg_replace('/--(.*?);/', '', $schema); |
80 | 80 | $schema = preg_replace('/[\r\n]/', ' ', $schema); |
81 | 81 | $schema = trim($schema, ' ;'); |
@@ -88,35 +88,35 @@ discard block |
||
88 | 88 | foreach ($_SERVER as $name => $value) { |
89 | 89 | if (strpos($name, $config_prefix) === 0) { |
90 | 90 | $name = substr($name, strlen($config_prefix)); |
91 | - echo 'Getting config from env: ' . $name . PHP_EOL; |
|
91 | + echo 'Getting config from env: '.$name.PHP_EOL; |
|
92 | 92 | $config[$name] = $value; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | $contents = file_get_contents($confpath); |
96 | 96 | foreach ($config as $name => $value) { |
97 | - $contents = preg_replace('/(define\s*\(\'' . $name . '\',\s*)(.*)(\);)/', '$1"' . $value . '"$3', $contents); |
|
97 | + $contents = preg_replace('/(define\s*\(\''.$name.'\',\s*)(.*)(\);)/', '$1"'.$value.'"$3', $contents); |
|
98 | 98 | } |
99 | 99 | file_put_contents($confpath, $contents); |
100 | 100 | function env($name, $default = null) |
101 | 101 | { |
102 | 102 | $v = getenv($name) ?: $default; |
103 | 103 | if ($v === null) { |
104 | - error('The env ' . $name . ' does not exist'); |
|
104 | + error('The env '.$name.' does not exist'); |
|
105 | 105 | } |
106 | 106 | return $v; |
107 | 107 | } |
108 | 108 | function error($text) |
109 | 109 | { |
110 | - echo 'Error: ' . $text . PHP_EOL; |
|
110 | + echo 'Error: '.$text.PHP_EOL; |
|
111 | 111 | exit(1); |
112 | 112 | } |
113 | 113 | function dbconnect($config) |
114 | 114 | { |
115 | 115 | $map = array('host' => 'HOST', 'port' => 'PORT', 'dbname' => 'NAME'); |
116 | - $dsn = $config['DB_TYPE'] . ':'; |
|
116 | + $dsn = $config['DB_TYPE'].':'; |
|
117 | 117 | foreach ($map as $d => $h) { |
118 | - if (isset($config['DB_' . $h])) { |
|
119 | - $dsn .= $d . '=' . $config['DB_' . $h] . ';'; |
|
118 | + if (isset($config['DB_'.$h])) { |
|
119 | + $dsn .= $d.'='.$config['DB_'.$h].';'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | $pdo = new \PDO($dsn, $config['DB_USER'], $config['DB_PASS']); |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | try { |
73 | 73 | $pdo->query('SELECT 1 FROM ttrss_feeds'); |
74 | 74 | // reached this point => table found, assume db is complete |
75 | -} |
|
76 | -catch (PDOException $e) { |
|
75 | +} catch (PDOException $e) { |
|
77 | 76 | echo 'Database table not found, applying schema... ' . PHP_EOL; |
78 | 77 | $schema = file_get_contents('schema/ttrss_schema_' . $config['DB_TYPE'] . '.sql'); |
79 | 78 | $schema = preg_replace('/--(.*?);/', '', $schema); |
@@ -128,8 +127,7 @@ discard block |
||
128 | 127 | try { |
129 | 128 | dbconnect($config); |
130 | 129 | return true; |
131 | - } |
|
132 | - catch (PDOException $e) { |
|
130 | + } catch (PDOException $e) { |
|
133 | 131 | return false; |
134 | 132 | } |
135 | 133 | } |
@@ -139,119 +139,119 @@ |
||
139 | 139 | private function getPluralizationRule(int $number, string $locale): int |
140 | 140 | { |
141 | 141 | switch ('pt_BR' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) { |
142 | - case 'af': |
|
143 | - case 'bn': |
|
144 | - case 'bg': |
|
145 | - case 'ca': |
|
146 | - case 'da': |
|
147 | - case 'de': |
|
148 | - case 'el': |
|
149 | - case 'en': |
|
150 | - case 'eo': |
|
151 | - case 'es': |
|
152 | - case 'et': |
|
153 | - case 'eu': |
|
154 | - case 'fa': |
|
155 | - case 'fi': |
|
156 | - case 'fo': |
|
157 | - case 'fur': |
|
158 | - case 'fy': |
|
159 | - case 'gl': |
|
160 | - case 'gu': |
|
161 | - case 'ha': |
|
162 | - case 'he': |
|
163 | - case 'hu': |
|
164 | - case 'is': |
|
165 | - case 'it': |
|
166 | - case 'ku': |
|
167 | - case 'lb': |
|
168 | - case 'ml': |
|
169 | - case 'mn': |
|
170 | - case 'mr': |
|
171 | - case 'nah': |
|
172 | - case 'nb': |
|
173 | - case 'ne': |
|
174 | - case 'nl': |
|
175 | - case 'nn': |
|
176 | - case 'no': |
|
177 | - case 'oc': |
|
178 | - case 'om': |
|
179 | - case 'or': |
|
180 | - case 'pa': |
|
181 | - case 'pap': |
|
182 | - case 'ps': |
|
183 | - case 'pt': |
|
184 | - case 'so': |
|
185 | - case 'sq': |
|
186 | - case 'sv': |
|
187 | - case 'sw': |
|
188 | - case 'ta': |
|
189 | - case 'te': |
|
190 | - case 'tk': |
|
191 | - case 'ur': |
|
192 | - case 'zu': |
|
193 | - return (1 == $number) ? 0 : 1; |
|
194 | - |
|
195 | - case 'am': |
|
196 | - case 'bh': |
|
197 | - case 'fil': |
|
198 | - case 'fr': |
|
199 | - case 'gun': |
|
200 | - case 'hi': |
|
201 | - case 'hy': |
|
202 | - case 'ln': |
|
203 | - case 'mg': |
|
204 | - case 'nso': |
|
205 | - case 'pt_BR': |
|
206 | - case 'ti': |
|
207 | - case 'wa': |
|
208 | - return ((0 == $number) || (1 == $number)) ? 0 : 1; |
|
209 | - |
|
210 | - case 'be': |
|
211 | - case 'bs': |
|
212 | - case 'hr': |
|
213 | - case 'ru': |
|
214 | - case 'sh': |
|
215 | - case 'sr': |
|
216 | - case 'uk': |
|
217 | - return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); |
|
218 | - |
|
219 | - case 'cs': |
|
220 | - case 'sk': |
|
221 | - return (1 == $number) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); |
|
222 | - |
|
223 | - case 'ga': |
|
224 | - return (1 == $number) ? 0 : ((2 == $number) ? 1 : 2); |
|
225 | - |
|
226 | - case 'lt': |
|
227 | - return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); |
|
228 | - |
|
229 | - case 'sl': |
|
230 | - return (1 == $number % 100) ? 0 : ((2 == $number % 100) ? 1 : (((3 == $number % 100) || (4 == $number % 100)) ? 2 : 3)); |
|
231 | - |
|
232 | - case 'mk': |
|
233 | - return (1 == $number % 10) ? 0 : 1; |
|
234 | - |
|
235 | - case 'mt': |
|
236 | - return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); |
|
237 | - |
|
238 | - case 'lv': |
|
239 | - return (0 == $number) ? 0 : (((1 == $number % 10) && (11 != $number % 100)) ? 1 : 2); |
|
240 | - |
|
241 | - case 'pl': |
|
242 | - return (1 == $number) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); |
|
243 | - |
|
244 | - case 'cy': |
|
245 | - return (1 == $number) ? 0 : ((2 == $number) ? 1 : (((8 == $number) || (11 == $number)) ? 2 : 3)); |
|
246 | - |
|
247 | - case 'ro': |
|
248 | - return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); |
|
249 | - |
|
250 | - case 'ar': |
|
251 | - return (0 == $number) ? 0 : ((1 == $number) ? 1 : ((2 == $number) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); |
|
252 | - |
|
253 | - default: |
|
254 | - return 0; |
|
142 | + case 'af': |
|
143 | + case 'bn': |
|
144 | + case 'bg': |
|
145 | + case 'ca': |
|
146 | + case 'da': |
|
147 | + case 'de': |
|
148 | + case 'el': |
|
149 | + case 'en': |
|
150 | + case 'eo': |
|
151 | + case 'es': |
|
152 | + case 'et': |
|
153 | + case 'eu': |
|
154 | + case 'fa': |
|
155 | + case 'fi': |
|
156 | + case 'fo': |
|
157 | + case 'fur': |
|
158 | + case 'fy': |
|
159 | + case 'gl': |
|
160 | + case 'gu': |
|
161 | + case 'ha': |
|
162 | + case 'he': |
|
163 | + case 'hu': |
|
164 | + case 'is': |
|
165 | + case 'it': |
|
166 | + case 'ku': |
|
167 | + case 'lb': |
|
168 | + case 'ml': |
|
169 | + case 'mn': |
|
170 | + case 'mr': |
|
171 | + case 'nah': |
|
172 | + case 'nb': |
|
173 | + case 'ne': |
|
174 | + case 'nl': |
|
175 | + case 'nn': |
|
176 | + case 'no': |
|
177 | + case 'oc': |
|
178 | + case 'om': |
|
179 | + case 'or': |
|
180 | + case 'pa': |
|
181 | + case 'pap': |
|
182 | + case 'ps': |
|
183 | + case 'pt': |
|
184 | + case 'so': |
|
185 | + case 'sq': |
|
186 | + case 'sv': |
|
187 | + case 'sw': |
|
188 | + case 'ta': |
|
189 | + case 'te': |
|
190 | + case 'tk': |
|
191 | + case 'ur': |
|
192 | + case 'zu': |
|
193 | + return (1 == $number) ? 0 : 1; |
|
194 | + |
|
195 | + case 'am': |
|
196 | + case 'bh': |
|
197 | + case 'fil': |
|
198 | + case 'fr': |
|
199 | + case 'gun': |
|
200 | + case 'hi': |
|
201 | + case 'hy': |
|
202 | + case 'ln': |
|
203 | + case 'mg': |
|
204 | + case 'nso': |
|
205 | + case 'pt_BR': |
|
206 | + case 'ti': |
|
207 | + case 'wa': |
|
208 | + return ((0 == $number) || (1 == $number)) ? 0 : 1; |
|
209 | + |
|
210 | + case 'be': |
|
211 | + case 'bs': |
|
212 | + case 'hr': |
|
213 | + case 'ru': |
|
214 | + case 'sh': |
|
215 | + case 'sr': |
|
216 | + case 'uk': |
|
217 | + return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); |
|
218 | + |
|
219 | + case 'cs': |
|
220 | + case 'sk': |
|
221 | + return (1 == $number) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); |
|
222 | + |
|
223 | + case 'ga': |
|
224 | + return (1 == $number) ? 0 : ((2 == $number) ? 1 : 2); |
|
225 | + |
|
226 | + case 'lt': |
|
227 | + return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); |
|
228 | + |
|
229 | + case 'sl': |
|
230 | + return (1 == $number % 100) ? 0 : ((2 == $number % 100) ? 1 : (((3 == $number % 100) || (4 == $number % 100)) ? 2 : 3)); |
|
231 | + |
|
232 | + case 'mk': |
|
233 | + return (1 == $number % 10) ? 0 : 1; |
|
234 | + |
|
235 | + case 'mt': |
|
236 | + return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); |
|
237 | + |
|
238 | + case 'lv': |
|
239 | + return (0 == $number) ? 0 : (((1 == $number % 10) && (11 != $number % 100)) ? 1 : 2); |
|
240 | + |
|
241 | + case 'pl': |
|
242 | + return (1 == $number) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); |
|
243 | + |
|
244 | + case 'cy': |
|
245 | + return (1 == $number) ? 0 : ((2 == $number) ? 1 : (((8 == $number) || (11 == $number)) ? 2 : 3)); |
|
246 | + |
|
247 | + case 'ro': |
|
248 | + return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); |
|
249 | + |
|
250 | + case 'ar': |
|
251 | + return (0 == $number) ? 0 : ((1 == $number) ? 1 : ((2 == $number) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); |
|
252 | + |
|
253 | + default: |
|
254 | + return 0; |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
@@ -139,58 +139,7 @@ |
||
139 | 139 | private function getPluralizationRule(int $number, string $locale): int |
140 | 140 | { |
141 | 141 | switch ('pt_BR' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) { |
142 | - case 'af': |
|
143 | - case 'bn': |
|
144 | - case 'bg': |
|
145 | - case 'ca': |
|
146 | - case 'da': |
|
147 | - case 'de': |
|
148 | - case 'el': |
|
149 | - case 'en': |
|
150 | - case 'eo': |
|
151 | - case 'es': |
|
152 | - case 'et': |
|
153 | - case 'eu': |
|
154 | - case 'fa': |
|
155 | - case 'fi': |
|
156 | - case 'fo': |
|
157 | - case 'fur': |
|
158 | - case 'fy': |
|
159 | - case 'gl': |
|
160 | - case 'gu': |
|
161 | - case 'ha': |
|
162 | - case 'he': |
|
163 | - case 'hu': |
|
164 | - case 'is': |
|
165 | - case 'it': |
|
166 | - case 'ku': |
|
167 | - case 'lb': |
|
168 | - case 'ml': |
|
169 | - case 'mn': |
|
170 | - case 'mr': |
|
171 | - case 'nah': |
|
172 | - case 'nb': |
|
173 | - case 'ne': |
|
174 | - case 'nl': |
|
175 | - case 'nn': |
|
176 | - case 'no': |
|
177 | - case 'oc': |
|
178 | - case 'om': |
|
179 | - case 'or': |
|
180 | - case 'pa': |
|
181 | - case 'pap': |
|
182 | - case 'ps': |
|
183 | - case 'pt': |
|
184 | - case 'so': |
|
185 | - case 'sq': |
|
186 | - case 'sv': |
|
187 | - case 'sw': |
|
188 | - case 'ta': |
|
189 | - case 'te': |
|
190 | - case 'tk': |
|
191 | - case 'ur': |
|
192 | - case 'zu': |
|
193 | - return (1 == $number) ? 0 : 1; |
|
142 | + case 'af' : case 'bn' : case 'bg' : case 'ca' : case 'da' : case 'de' : case 'el' : case 'en' : case 'eo' : case 'es' : case 'et' : case 'eu' : case 'fa' : case 'fi' : case 'fo' : case 'fur' : case 'fy' : case 'gl' : case 'gu' : case 'ha' : case 'he' : case 'hu' : case 'is' : case 'it' : case 'ku' : case 'lb' : case 'ml' : case 'mn' : case 'mr' : case 'nah' : case 'nb' : case 'ne' : case 'nl' : case 'nn' : case 'no' : case 'oc' : case 'om' : case 'or' : case 'pa' : case 'pap' : case 'ps' : case 'pt' : case 'so' : case 'sq' : case 'sv' : case 'sw' : case 'ta' : case 'te' : case 'tk' : case 'ur' : case 'zu' : return (1 == $number) ? 0 : 1; |
|
194 | 143 | |
195 | 144 | case 'am': |
196 | 145 | case 'bh': |
@@ -77,7 +77,7 @@ |
||
77 | 77 | \s* |
78 | 78 | (?P<right_delimiter>[\[\]]) |
79 | 79 | )\s*(?P<message>.*?)$/xs |
80 | -EOF; |
|
80 | +eof; |
|
81 | 81 | |
82 | 82 | $standardRules = []; |
83 | 83 | foreach ($parts as $part) { |
@@ -72,7 +72,7 @@ |
||
72 | 72 | $translationFilePaths = findTranslationFiles($originalFilePath, $config['locale_to_analyze']); |
73 | 73 | $translationStatus = calculateTranslationStatus($originalFilePath, $translationFilePaths); |
74 | 74 | |
75 | - $totalMissingTranslations += array_sum(array_map(function ($translation) { |
|
75 | + $totalMissingTranslations += array_sum(array_map(function($translation) { |
|
76 | 76 | return count($translation['missingKeys']); |
77 | 77 | }, array_values($translationStatus))); |
78 | 78 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | # show the status of a single locale and all its missing translations |
29 | 29 | $ php translation-status.php fr -v |
30 | 30 | |
31 | -END; |
|
31 | +end; |
|
32 | 32 | |
33 | 33 | $config = [ |
34 | 34 | // if TRUE, the full list of missing translations is displayed |
@@ -278,7 +278,7 @@ |
||
278 | 278 | |
279 | 279 | $this->assertValidLocale($locale); |
280 | 280 | $cache = $this->getConfigCacheFactory()->cache($this->getCatalogueCachePath($locale), |
281 | - function (ConfigCacheInterface $cache) use ($locale) { |
|
281 | + function(ConfigCacheInterface $cache) use ($locale) { |
|
282 | 282 | $this->dumpCatalogue($locale, $cache); |
283 | 283 | } |
284 | 284 | ); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | %s |
308 | 308 | return \$catalogue; |
309 | 309 | |
310 | -EOF |
|
310 | +eof |
|
311 | 311 | , |
312 | 312 | $locale, |
313 | 313 | var_export($this->getAllMessages($this->catalogues[$locale]), true), |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $catalogue%s = new MessageCatalogue('%s', %s); |
333 | 333 | $catalogue%s->addFallbackCatalogue($catalogue%s); |
334 | 334 | |
335 | -EOF |
|
335 | +eof |
|
336 | 336 | , |
337 | 337 | $fallbackSuffix, |
338 | 338 | $fallback, |
@@ -154,12 +154,12 @@ |
||
154 | 154 | private function display(SymfonyStyle $io, array $files) |
155 | 155 | { |
156 | 156 | switch ($this->format) { |
157 | - case 'txt': |
|
158 | - return $this->displayTxt($io, $files); |
|
159 | - case 'json': |
|
160 | - return $this->displayJson($io, $files); |
|
161 | - default: |
|
162 | - throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); |
|
157 | + case 'txt': |
|
158 | + return $this->displayTxt($io, $files); |
|
159 | + case 'json': |
|
160 | + return $this->displayJson($io, $files); |
|
161 | + default: |
|
162 | + throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } elseif (!$info['valid']) { |
175 | 175 | ++$erroredFiles; |
176 | 176 | $io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
177 | - $io->listing(array_map(function ($error) { |
|
177 | + $io->listing(array_map(function($error) { |
|
178 | 178 | // general document errors have a '-1' line number |
179 | 179 | return -1 === $error['line'] ? $error['message'] : sprintf('Line %d, Column %d: %s', $error['line'], $error['column'], $error['message']); |
180 | 180 | }, $info['messages'])); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | { |
195 | 195 | $errors = 0; |
196 | 196 | |
197 | - array_walk($filesInfo, function (&$v) use (&$errors) { |
|
197 | + array_walk($filesInfo, function(&$v) use (&$errors) { |
|
198 | 198 | $v['file'] = (string) $v['file']; |
199 | 199 | if (!$v['valid']) { |
200 | 200 | ++$errors; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | private function getDirectoryIterator(string $directory) |
227 | 227 | { |
228 | - $default = function ($directory) { |
|
228 | + $default = function($directory) { |
|
229 | 229 | return new \RecursiveIteratorIterator( |
230 | 230 | new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), |
231 | 231 | \RecursiveIteratorIterator::LEAVES_ONLY |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | private function isReadable(string $fileOrDirectory) |
243 | 243 | { |
244 | - $default = function ($fileOrDirectory) { |
|
244 | + $default = function($fileOrDirectory) { |
|
245 | 245 | return is_readable($fileOrDirectory); |
246 | 246 | }; |
247 | 247 |
@@ -72,7 +72,7 @@ |
||
72 | 72 | <info>php %command.full_name% dirname</info> |
73 | 73 | <info>php %command.full_name% dirname --format=json</info> |
74 | 74 | |
75 | -EOF |
|
75 | +eof |
|
76 | 76 | ) |
77 | 77 | ; |
78 | 78 | } |
@@ -43,18 +43,18 @@ |
||
43 | 43 | private function getJSONErrorMessage(int $errorCode): string |
44 | 44 | { |
45 | 45 | switch ($errorCode) { |
46 | - case JSON_ERROR_DEPTH: |
|
47 | - return 'Maximum stack depth exceeded'; |
|
48 | - case JSON_ERROR_STATE_MISMATCH: |
|
49 | - return 'Underflow or the modes mismatch'; |
|
50 | - case JSON_ERROR_CTRL_CHAR: |
|
51 | - return 'Unexpected control character found'; |
|
52 | - case JSON_ERROR_SYNTAX: |
|
53 | - return 'Syntax error, malformed JSON'; |
|
54 | - case JSON_ERROR_UTF8: |
|
55 | - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
56 | - default: |
|
57 | - return 'Unknown error'; |
|
46 | + case JSON_ERROR_DEPTH: |
|
47 | + return 'Maximum stack depth exceeded'; |
|
48 | + case JSON_ERROR_STATE_MISMATCH: |
|
49 | + return 'Underflow or the modes mismatch'; |
|
50 | + case JSON_ERROR_CTRL_CHAR: |
|
51 | + return 'Unexpected control character found'; |
|
52 | + case JSON_ERROR_SYNTAX: |
|
53 | + return 'Syntax error, malformed JSON'; |
|
54 | + case JSON_ERROR_UTF8: |
|
55 | + return 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
56 | + default: |
|
57 | + return 'Unknown error'; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -52,16 +52,16 @@ |
||
52 | 52 | |
53 | 53 | foreach ($offsets as $offset) { |
54 | 54 | $sourceOffsets .= $this->writeLong($offset[1]) |
55 | - .$this->writeLong($offset[0] + $sourcesStart); |
|
55 | + .$this->writeLong($offset[0] + $sourcesStart); |
|
56 | 56 | $targetOffsets .= $this->writeLong($offset[3]) |
57 | - .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); |
|
57 | + .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $output = implode('', array_map([$this, 'writeLong'], $header)) |
61 | - .$sourceOffsets |
|
62 | - .$targetOffsets |
|
63 | - .$sources |
|
64 | - .$targets |
|
61 | + .$sourceOffsets |
|
62 | + .$targetOffsets |
|
63 | + .$sources |
|
64 | + .$targets |
|
65 | 65 | ; |
66 | 66 | |
67 | 67 | return $output; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $data .= pack('V', \strlen($target)) |
48 | 48 | .mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8') |
49 | 49 | .$this->writePadding($data) |
50 | - ; |
|
50 | + ; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $resOffset = $this->getPosition($data); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | .$indexes |
57 | 57 | .$this->writePadding($data) |
58 | 58 | .$resources |
59 | - ; |
|
59 | + ; |
|
60 | 60 | |
61 | 61 | $bundleTop = $this->getPosition($data); |
62 | 62 |
@@ -62,20 +62,20 @@ |
||
62 | 62 | |
63 | 63 | $root = pack('V7', |
64 | 64 | $resOffset + (2 << 28), // Resource Offset + Resource Type |
65 | - 6, // Index length |
|
66 | - $keyTop, // Index keys top |
|
67 | - $bundleTop, // Index resources top |
|
68 | - $bundleTop, // Index bundle top |
|
65 | + 6, // Index length |
|
66 | + $keyTop, // Index keys top |
|
67 | + $bundleTop, // Index resources top |
|
68 | + $bundleTop, // Index bundle top |
|
69 | 69 | \count($messages->all($domain)), // Index max table length |
70 | 70 | 0 // Index attributes |
71 | 71 | ); |
72 | 72 | |
73 | 73 | $header = pack('vC2v4C12@32', |
74 | - 32, // Header size |
|
75 | - 0xDA, 0x27, // Magic number 1 and 2 |
|
76 | - 20, 0, 0, 2, // Rest of the header, ..., Size of a char |
|
74 | + 32, // Header size |
|
75 | + 0xDA, 0x27, // Magic number 1 and 2 |
|
76 | + 20, 0, 0, 2, // Rest of the header, ..., Size of a char |
|
77 | 77 | 0x52, 0x65, 0x73, 0x42, // Data format identifier |
78 | - 1, 2, 0, 0, // Data version |
|
78 | + 1, 2, 0, 0, // Data version |
|
79 | 79 | 1, 4, 0, 0 // Unicode version |
80 | 80 | ); |
81 | 81 |