@@ -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 | } |
@@ -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 | } |
@@ -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 | |
@@ -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 | } |
@@ -148,26 +148,26 @@ |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | switch ($t[0]) { |
| 151 | - case T_START_HEREDOC: |
|
| 152 | - $docToken = $t[1]; |
|
| 153 | - break; |
|
| 154 | - case T_ENCAPSED_AND_WHITESPACE: |
|
| 155 | - case T_CONSTANT_ENCAPSED_STRING: |
|
| 156 | - if ('' === $docToken) { |
|
| 157 | - $message .= PhpStringTokenParser::parse($t[1]); |
|
| 158 | - } else { |
|
| 159 | - $docPart = $t[1]; |
|
| 160 | - } |
|
| 161 | - break; |
|
| 162 | - case T_END_HEREDOC: |
|
| 163 | - $message .= PhpStringTokenParser::parseDocString($docToken, $docPart); |
|
| 164 | - $docToken = ''; |
|
| 165 | - $docPart = ''; |
|
| 166 | - break; |
|
| 167 | - case T_WHITESPACE: |
|
| 168 | - break; |
|
| 169 | - default: |
|
| 170 | - break 2; |
|
| 151 | + case T_START_HEREDOC: |
|
| 152 | + $docToken = $t[1]; |
|
| 153 | + break; |
|
| 154 | + case T_ENCAPSED_AND_WHITESPACE: |
|
| 155 | + case T_CONSTANT_ENCAPSED_STRING: |
|
| 156 | + if ('' === $docToken) { |
|
| 157 | + $message .= PhpStringTokenParser::parse($t[1]); |
|
| 158 | + } else { |
|
| 159 | + $docPart = $t[1]; |
|
| 160 | + } |
|
| 161 | + break; |
|
| 162 | + case T_END_HEREDOC: |
|
| 163 | + $message .= PhpStringTokenParser::parseDocString($docToken, $docPart); |
|
| 164 | + $docToken = ''; |
|
| 165 | + $docPart = ''; |
|
| 166 | + break; |
|
| 167 | + case T_WHITESPACE: |
|
| 168 | + break; |
|
| 169 | + default: |
|
| 170 | + break 2; |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
@@ -371,11 +371,11 @@ discard block |
||
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | switch ($lang = strtolower($lang)) { |
| 374 | - case 'uni': |
|
| 375 | - case 'neutral': |
|
| 376 | - self::$language = $lang; |
|
| 374 | + case 'uni': |
|
| 375 | + case 'neutral': |
|
| 376 | + self::$language = $lang; |
|
| 377 | 377 | |
| 378 | - return true; |
|
| 378 | + return true; |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | return false; |
@@ -389,9 +389,9 @@ discard block |
||
| 389 | 389 | public static function mb_encoding_aliases($encoding) |
| 390 | 390 | { |
| 391 | 391 | switch (strtoupper($encoding)) { |
| 392 | - case 'UTF8': |
|
| 393 | - case 'UTF-8': |
|
| 394 | - return array('utf8'); |
|
| 392 | + case 'UTF8': |
|
| 393 | + case 'UTF-8': |
|
| 394 | + return array('utf8'); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | return false; |
@@ -422,23 +422,23 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | foreach ($encodingList as $enc) { |
| 424 | 424 | switch ($enc) { |
| 425 | - case 'ASCII': |
|
| 426 | - if (!preg_match('/[\x80-\xFF]/', $str)) { |
|
| 427 | - return $enc; |
|
| 428 | - } |
|
| 429 | - break; |
|
| 425 | + case 'ASCII': |
|
| 426 | + if (!preg_match('/[\x80-\xFF]/', $str)) { |
|
| 427 | + return $enc; |
|
| 428 | + } |
|
| 429 | + break; |
|
| 430 | 430 | |
| 431 | - case 'UTF8': |
|
| 432 | - case 'UTF-8': |
|
| 433 | - if (preg_match('//u', $str)) { |
|
| 434 | - return 'UTF-8'; |
|
| 435 | - } |
|
| 436 | - break; |
|
| 431 | + case 'UTF8': |
|
| 432 | + case 'UTF-8': |
|
| 433 | + if (preg_match('//u', $str)) { |
|
| 434 | + return 'UTF-8'; |
|
| 435 | + } |
|
| 436 | + break; |
|
| 437 | 437 | |
| 438 | - default: |
|
| 439 | - if (0 === strncmp($enc, 'ISO-8859-', 9)) { |
|
| 440 | - return $enc; |
|
| 441 | - } |
|
| 438 | + default: |
|
| 439 | + if (0 === strncmp($enc, 'ISO-8859-', 9)) { |
|
| 440 | + return $enc; |
|
| 441 | + } |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
@@ -458,14 +458,14 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | foreach ($encodingList as $enc) { |
| 460 | 460 | switch ($enc) { |
| 461 | - default: |
|
| 462 | - if (strncmp($enc, 'ISO-8859-', 9)) { |
|
| 463 | - return false; |
|
| 464 | - } |
|
| 465 | - // no break |
|
| 466 | - case 'ASCII': |
|
| 467 | - case 'UTF8': |
|
| 468 | - case 'UTF-8': |
|
| 461 | + default: |
|
| 462 | + if (strncmp($enc, 'ISO-8859-', 9)) { |
|
| 463 | + return false; |
|
| 464 | + } |
|
| 465 | + // no break |
|
| 466 | + case 'ASCII': |
|
| 467 | + case 'UTF8': |
|
| 468 | + case 'UTF-8': |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | |