@@ -12,136 +12,136 @@ |
||
| 12 | 12 | use Symfony\Polyfill\Mbstring as p; |
| 13 | 13 | |
| 14 | 14 | if (\PHP_VERSION_ID >= 80000) { |
| 15 | - return require __DIR__.'/bootstrap80.php'; |
|
| 15 | + return require __DIR__.'/bootstrap80.php'; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if (!function_exists('mb_convert_encoding')) { |
| 19 | - function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); } |
|
| 19 | + function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); } |
|
| 20 | 20 | } |
| 21 | 21 | if (!function_exists('mb_decode_mimeheader')) { |
| 22 | - function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); } |
|
| 22 | + function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); } |
|
| 23 | 23 | } |
| 24 | 24 | if (!function_exists('mb_encode_mimeheader')) { |
| 25 | - function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); } |
|
| 25 | + function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); } |
|
| 26 | 26 | } |
| 27 | 27 | if (!function_exists('mb_decode_numericentity')) { |
| 28 | - function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); } |
|
| 28 | + function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); } |
|
| 29 | 29 | } |
| 30 | 30 | if (!function_exists('mb_encode_numericentity')) { |
| 31 | - function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); } |
|
| 31 | + function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); } |
|
| 32 | 32 | } |
| 33 | 33 | if (!function_exists('mb_convert_case')) { |
| 34 | - function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); } |
|
| 34 | + function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); } |
|
| 35 | 35 | } |
| 36 | 36 | if (!function_exists('mb_internal_encoding')) { |
| 37 | - function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); } |
|
| 37 | + function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); } |
|
| 38 | 38 | } |
| 39 | 39 | if (!function_exists('mb_language')) { |
| 40 | - function mb_language($language = null) { return p\Mbstring::mb_language($language); } |
|
| 40 | + function mb_language($language = null) { return p\Mbstring::mb_language($language); } |
|
| 41 | 41 | } |
| 42 | 42 | if (!function_exists('mb_list_encodings')) { |
| 43 | - function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } |
|
| 43 | + function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } |
|
| 44 | 44 | } |
| 45 | 45 | if (!function_exists('mb_encoding_aliases')) { |
| 46 | - function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } |
|
| 46 | + function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } |
|
| 47 | 47 | } |
| 48 | 48 | if (!function_exists('mb_check_encoding')) { |
| 49 | - function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
| 49 | + function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
| 50 | 50 | } |
| 51 | 51 | if (!function_exists('mb_detect_encoding')) { |
| 52 | - function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); } |
|
| 52 | + function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); } |
|
| 53 | 53 | } |
| 54 | 54 | if (!function_exists('mb_detect_order')) { |
| 55 | - function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); } |
|
| 55 | + function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); } |
|
| 56 | 56 | } |
| 57 | 57 | if (!function_exists('mb_parse_str')) { |
| 58 | - function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; } |
|
| 58 | + function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; } |
|
| 59 | 59 | } |
| 60 | 60 | if (!function_exists('mb_strlen')) { |
| 61 | - function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); } |
|
| 61 | + function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); } |
|
| 62 | 62 | } |
| 63 | 63 | if (!function_exists('mb_strpos')) { |
| 64 | - function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); } |
|
| 64 | + function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); } |
|
| 65 | 65 | } |
| 66 | 66 | if (!function_exists('mb_strtolower')) { |
| 67 | - function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); } |
|
| 67 | + function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); } |
|
| 68 | 68 | } |
| 69 | 69 | if (!function_exists('mb_strtoupper')) { |
| 70 | - function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); } |
|
| 70 | + function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); } |
|
| 71 | 71 | } |
| 72 | 72 | if (!function_exists('mb_substitute_character')) { |
| 73 | - function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
| 73 | + function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
| 74 | 74 | } |
| 75 | 75 | if (!function_exists('mb_substr')) { |
| 76 | - function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); } |
|
| 76 | + function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); } |
|
| 77 | 77 | } |
| 78 | 78 | if (!function_exists('mb_stripos')) { |
| 79 | - function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); } |
|
| 79 | + function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); } |
|
| 80 | 80 | } |
| 81 | 81 | if (!function_exists('mb_stristr')) { |
| 82 | - function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); } |
|
| 82 | + function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); } |
|
| 83 | 83 | } |
| 84 | 84 | if (!function_exists('mb_strrchr')) { |
| 85 | - function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); } |
|
| 85 | + function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); } |
|
| 86 | 86 | } |
| 87 | 87 | if (!function_exists('mb_strrichr')) { |
| 88 | - function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); } |
|
| 88 | + function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); } |
|
| 89 | 89 | } |
| 90 | 90 | if (!function_exists('mb_strripos')) { |
| 91 | - function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); } |
|
| 91 | + function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); } |
|
| 92 | 92 | } |
| 93 | 93 | if (!function_exists('mb_strrpos')) { |
| 94 | - function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); } |
|
| 94 | + function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); } |
|
| 95 | 95 | } |
| 96 | 96 | if (!function_exists('mb_strstr')) { |
| 97 | - function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); } |
|
| 97 | + function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); } |
|
| 98 | 98 | } |
| 99 | 99 | if (!function_exists('mb_get_info')) { |
| 100 | - function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } |
|
| 100 | + function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } |
|
| 101 | 101 | } |
| 102 | 102 | if (!function_exists('mb_http_output')) { |
| 103 | - function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); } |
|
| 103 | + function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); } |
|
| 104 | 104 | } |
| 105 | 105 | if (!function_exists('mb_strwidth')) { |
| 106 | - function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); } |
|
| 106 | + function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); } |
|
| 107 | 107 | } |
| 108 | 108 | if (!function_exists('mb_substr_count')) { |
| 109 | - function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); } |
|
| 109 | + function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); } |
|
| 110 | 110 | } |
| 111 | 111 | if (!function_exists('mb_output_handler')) { |
| 112 | - function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); } |
|
| 112 | + function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); } |
|
| 113 | 113 | } |
| 114 | 114 | if (!function_exists('mb_http_input')) { |
| 115 | - function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); } |
|
| 115 | + function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); } |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (!function_exists('mb_convert_variables')) { |
| 119 | - function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); } |
|
| 119 | + function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); } |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (!function_exists('mb_ord')) { |
| 123 | - function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); } |
|
| 123 | + function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); } |
|
| 124 | 124 | } |
| 125 | 125 | if (!function_exists('mb_chr')) { |
| 126 | - function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); } |
|
| 126 | + function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); } |
|
| 127 | 127 | } |
| 128 | 128 | if (!function_exists('mb_scrub')) { |
| 129 | - function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); } |
|
| 129 | + function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); } |
|
| 130 | 130 | } |
| 131 | 131 | if (!function_exists('mb_str_split')) { |
| 132 | - function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } |
|
| 132 | + function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (extension_loaded('mbstring')) { |
| 136 | - return; |
|
| 136 | + return; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (!defined('MB_CASE_UPPER')) { |
| 140 | - define('MB_CASE_UPPER', 0); |
|
| 140 | + define('MB_CASE_UPPER', 0); |
|
| 141 | 141 | } |
| 142 | 142 | if (!defined('MB_CASE_LOWER')) { |
| 143 | - define('MB_CASE_LOWER', 1); |
|
| 143 | + define('MB_CASE_LOWER', 1); |
|
| 144 | 144 | } |
| 145 | 145 | if (!defined('MB_CASE_TITLE')) { |
| 146 | - define('MB_CASE_TITLE', 2); |
|
| 146 | + define('MB_CASE_TITLE', 2); |
|
| 147 | 147 | } |
@@ -12,132 +12,132 @@ |
||
| 12 | 12 | use Symfony\Polyfill\Mbstring as p; |
| 13 | 13 | |
| 14 | 14 | if (!function_exists('mb_convert_encoding')) { |
| 15 | - function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } |
|
| 15 | + function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } |
|
| 16 | 16 | } |
| 17 | 17 | if (!function_exists('mb_decode_mimeheader')) { |
| 18 | - function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } |
|
| 18 | + function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } |
|
| 19 | 19 | } |
| 20 | 20 | if (!function_exists('mb_encode_mimeheader')) { |
| 21 | - function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); } |
|
| 21 | + function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); } |
|
| 22 | 22 | } |
| 23 | 23 | if (!function_exists('mb_decode_numericentity')) { |
| 24 | - function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); } |
|
| 24 | + function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); } |
|
| 25 | 25 | } |
| 26 | 26 | if (!function_exists('mb_encode_numericentity')) { |
| 27 | - function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); } |
|
| 27 | + function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); } |
|
| 28 | 28 | } |
| 29 | 29 | if (!function_exists('mb_convert_case')) { |
| 30 | - function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } |
|
| 30 | + function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } |
|
| 31 | 31 | } |
| 32 | 32 | if (!function_exists('mb_internal_encoding')) { |
| 33 | - function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } |
|
| 33 | + function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } |
|
| 34 | 34 | } |
| 35 | 35 | if (!function_exists('mb_language')) { |
| 36 | - function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } |
|
| 36 | + function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } |
|
| 37 | 37 | } |
| 38 | 38 | if (!function_exists('mb_list_encodings')) { |
| 39 | - function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } |
|
| 39 | + function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } |
|
| 40 | 40 | } |
| 41 | 41 | if (!function_exists('mb_encoding_aliases')) { |
| 42 | - function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } |
|
| 42 | + function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } |
|
| 43 | 43 | } |
| 44 | 44 | if (!function_exists('mb_check_encoding')) { |
| 45 | - function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
| 45 | + function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
| 46 | 46 | } |
| 47 | 47 | if (!function_exists('mb_detect_encoding')) { |
| 48 | - function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } |
|
| 48 | + function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } |
|
| 49 | 49 | } |
| 50 | 50 | if (!function_exists('mb_detect_order')) { |
| 51 | - function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } |
|
| 51 | + function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } |
|
| 52 | 52 | } |
| 53 | 53 | if (!function_exists('mb_parse_str')) { |
| 54 | - function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } |
|
| 54 | + function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } |
|
| 55 | 55 | } |
| 56 | 56 | if (!function_exists('mb_strlen')) { |
| 57 | - function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } |
|
| 57 | + function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } |
|
| 58 | 58 | } |
| 59 | 59 | if (!function_exists('mb_strpos')) { |
| 60 | - function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 60 | + function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 61 | 61 | } |
| 62 | 62 | if (!function_exists('mb_strtolower')) { |
| 63 | - function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } |
|
| 63 | + function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } |
|
| 64 | 64 | } |
| 65 | 65 | if (!function_exists('mb_strtoupper')) { |
| 66 | - function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } |
|
| 66 | + function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } |
|
| 67 | 67 | } |
| 68 | 68 | if (!function_exists('mb_substitute_character')) { |
| 69 | - function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
| 69 | + function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
| 70 | 70 | } |
| 71 | 71 | if (!function_exists('mb_substr')) { |
| 72 | - function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } |
|
| 72 | + function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } |
|
| 73 | 73 | } |
| 74 | 74 | if (!function_exists('mb_stripos')) { |
| 75 | - function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 75 | + function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 76 | 76 | } |
| 77 | 77 | if (!function_exists('mb_stristr')) { |
| 78 | - function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 78 | + function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 79 | 79 | } |
| 80 | 80 | if (!function_exists('mb_strrchr')) { |
| 81 | - function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 81 | + function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 82 | 82 | } |
| 83 | 83 | if (!function_exists('mb_strrichr')) { |
| 84 | - function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 84 | + function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 85 | 85 | } |
| 86 | 86 | if (!function_exists('mb_strripos')) { |
| 87 | - function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 87 | + function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 88 | 88 | } |
| 89 | 89 | if (!function_exists('mb_strrpos')) { |
| 90 | - function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 90 | + function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
| 91 | 91 | } |
| 92 | 92 | if (!function_exists('mb_strstr')) { |
| 93 | - function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 93 | + function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
| 94 | 94 | } |
| 95 | 95 | if (!function_exists('mb_get_info')) { |
| 96 | - function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); } |
|
| 96 | + function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); } |
|
| 97 | 97 | } |
| 98 | 98 | if (!function_exists('mb_http_output')) { |
| 99 | - function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } |
|
| 99 | + function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } |
|
| 100 | 100 | } |
| 101 | 101 | if (!function_exists('mb_strwidth')) { |
| 102 | - function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } |
|
| 102 | + function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } |
|
| 103 | 103 | } |
| 104 | 104 | if (!function_exists('mb_substr_count')) { |
| 105 | - function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); } |
|
| 105 | + function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); } |
|
| 106 | 106 | } |
| 107 | 107 | if (!function_exists('mb_output_handler')) { |
| 108 | - function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } |
|
| 108 | + function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } |
|
| 109 | 109 | } |
| 110 | 110 | if (!function_exists('mb_http_input')) { |
| 111 | - function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } |
|
| 111 | + function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if (!function_exists('mb_convert_variables')) { |
| 115 | - function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } |
|
| 115 | + function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (!function_exists('mb_ord')) { |
| 119 | - function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } |
|
| 119 | + function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } |
|
| 120 | 120 | } |
| 121 | 121 | if (!function_exists('mb_chr')) { |
| 122 | - function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } |
|
| 122 | + function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } |
|
| 123 | 123 | } |
| 124 | 124 | if (!function_exists('mb_scrub')) { |
| 125 | - function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } |
|
| 125 | + function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } |
|
| 126 | 126 | } |
| 127 | 127 | if (!function_exists('mb_str_split')) { |
| 128 | - function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } |
|
| 128 | + function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (extension_loaded('mbstring')) { |
| 132 | - return; |
|
| 132 | + return; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (!defined('MB_CASE_UPPER')) { |
| 136 | - define('MB_CASE_UPPER', 0); |
|
| 136 | + define('MB_CASE_UPPER', 0); |
|
| 137 | 137 | } |
| 138 | 138 | if (!defined('MB_CASE_LOWER')) { |
| 139 | - define('MB_CASE_LOWER', 1); |
|
| 139 | + define('MB_CASE_LOWER', 1); |
|
| 140 | 140 | } |
| 141 | 141 | if (!defined('MB_CASE_TITLE')) { |
| 142 | - define('MB_CASE_TITLE', 2); |
|
| 142 | + define('MB_CASE_TITLE', 2); |
|
| 143 | 143 | } |
@@ -13,20 +13,20 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | trait LoggerAwareTrait |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * The logger instance. |
|
| 18 | - * |
|
| 19 | - * @var LoggerInterface|null |
|
| 20 | - */ |
|
| 21 | - protected $logger; |
|
| 16 | + /** |
|
| 17 | + * The logger instance. |
|
| 18 | + * |
|
| 19 | + * @var LoggerInterface|null |
|
| 20 | + */ |
|
| 21 | + protected $logger; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Sets a logger. |
|
| 25 | - * |
|
| 26 | - * @param LoggerInterface $logger |
|
| 27 | - */ |
|
| 28 | - public function setLogger(LoggerInterface $logger) |
|
| 29 | - { |
|
| 30 | - $this->logger = $logger; |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * Sets a logger. |
|
| 25 | + * |
|
| 26 | + * @param LoggerInterface $logger |
|
| 27 | + */ |
|
| 28 | + public function setLogger(LoggerInterface $logger) |
|
| 29 | + { |
|
| 30 | + $this->logger = $logger; |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -17,118 +17,118 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | abstract class AbstractLogger implements LoggerInterface |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * System is unusable. |
|
| 22 | - * |
|
| 23 | - * @param string $message |
|
| 24 | - * @param mixed[] $context |
|
| 25 | - * |
|
| 26 | - * @return void |
|
| 27 | - */ |
|
| 28 | - public function emergency($message, array $context = array()) |
|
| 29 | - { |
|
| 30 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 31 | - } |
|
| 20 | + /** |
|
| 21 | + * System is unusable. |
|
| 22 | + * |
|
| 23 | + * @param string $message |
|
| 24 | + * @param mixed[] $context |
|
| 25 | + * |
|
| 26 | + * @return void |
|
| 27 | + */ |
|
| 28 | + public function emergency($message, array $context = array()) |
|
| 29 | + { |
|
| 30 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Action must be taken immediately. |
|
| 35 | - * |
|
| 36 | - * Example: Entire website down, database unavailable, etc. This should |
|
| 37 | - * trigger the SMS alerts and wake you up. |
|
| 38 | - * |
|
| 39 | - * @param string $message |
|
| 40 | - * @param mixed[] $context |
|
| 41 | - * |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public function alert($message, array $context = array()) |
|
| 45 | - { |
|
| 46 | - $this->log(LogLevel::ALERT, $message, $context); |
|
| 47 | - } |
|
| 33 | + /** |
|
| 34 | + * Action must be taken immediately. |
|
| 35 | + * |
|
| 36 | + * Example: Entire website down, database unavailable, etc. This should |
|
| 37 | + * trigger the SMS alerts and wake you up. |
|
| 38 | + * |
|
| 39 | + * @param string $message |
|
| 40 | + * @param mixed[] $context |
|
| 41 | + * |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public function alert($message, array $context = array()) |
|
| 45 | + { |
|
| 46 | + $this->log(LogLevel::ALERT, $message, $context); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Critical conditions. |
|
| 51 | - * |
|
| 52 | - * Example: Application component unavailable, unexpected exception. |
|
| 53 | - * |
|
| 54 | - * @param string $message |
|
| 55 | - * @param mixed[] $context |
|
| 56 | - * |
|
| 57 | - * @return void |
|
| 58 | - */ |
|
| 59 | - public function critical($message, array $context = array()) |
|
| 60 | - { |
|
| 61 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 62 | - } |
|
| 49 | + /** |
|
| 50 | + * Critical conditions. |
|
| 51 | + * |
|
| 52 | + * Example: Application component unavailable, unexpected exception. |
|
| 53 | + * |
|
| 54 | + * @param string $message |
|
| 55 | + * @param mixed[] $context |
|
| 56 | + * |
|
| 57 | + * @return void |
|
| 58 | + */ |
|
| 59 | + public function critical($message, array $context = array()) |
|
| 60 | + { |
|
| 61 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Runtime errors that do not require immediate action but should typically |
|
| 66 | - * be logged and monitored. |
|
| 67 | - * |
|
| 68 | - * @param string $message |
|
| 69 | - * @param mixed[] $context |
|
| 70 | - * |
|
| 71 | - * @return void |
|
| 72 | - */ |
|
| 73 | - public function error($message, array $context = array()) |
|
| 74 | - { |
|
| 75 | - $this->log(LogLevel::ERROR, $message, $context); |
|
| 76 | - } |
|
| 64 | + /** |
|
| 65 | + * Runtime errors that do not require immediate action but should typically |
|
| 66 | + * be logged and monitored. |
|
| 67 | + * |
|
| 68 | + * @param string $message |
|
| 69 | + * @param mixed[] $context |
|
| 70 | + * |
|
| 71 | + * @return void |
|
| 72 | + */ |
|
| 73 | + public function error($message, array $context = array()) |
|
| 74 | + { |
|
| 75 | + $this->log(LogLevel::ERROR, $message, $context); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Exceptional occurrences that are not errors. |
|
| 80 | - * |
|
| 81 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 82 | - * that are not necessarily wrong. |
|
| 83 | - * |
|
| 84 | - * @param string $message |
|
| 85 | - * @param mixed[] $context |
|
| 86 | - * |
|
| 87 | - * @return void |
|
| 88 | - */ |
|
| 89 | - public function warning($message, array $context = array()) |
|
| 90 | - { |
|
| 91 | - $this->log(LogLevel::WARNING, $message, $context); |
|
| 92 | - } |
|
| 78 | + /** |
|
| 79 | + * Exceptional occurrences that are not errors. |
|
| 80 | + * |
|
| 81 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 82 | + * that are not necessarily wrong. |
|
| 83 | + * |
|
| 84 | + * @param string $message |
|
| 85 | + * @param mixed[] $context |
|
| 86 | + * |
|
| 87 | + * @return void |
|
| 88 | + */ |
|
| 89 | + public function warning($message, array $context = array()) |
|
| 90 | + { |
|
| 91 | + $this->log(LogLevel::WARNING, $message, $context); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Normal but significant events. |
|
| 96 | - * |
|
| 97 | - * @param string $message |
|
| 98 | - * @param mixed[] $context |
|
| 99 | - * |
|
| 100 | - * @return void |
|
| 101 | - */ |
|
| 102 | - public function notice($message, array $context = array()) |
|
| 103 | - { |
|
| 104 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
| 105 | - } |
|
| 94 | + /** |
|
| 95 | + * Normal but significant events. |
|
| 96 | + * |
|
| 97 | + * @param string $message |
|
| 98 | + * @param mixed[] $context |
|
| 99 | + * |
|
| 100 | + * @return void |
|
| 101 | + */ |
|
| 102 | + public function notice($message, array $context = array()) |
|
| 103 | + { |
|
| 104 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Interesting events. |
|
| 109 | - * |
|
| 110 | - * Example: User logs in, SQL logs. |
|
| 111 | - * |
|
| 112 | - * @param string $message |
|
| 113 | - * @param mixed[] $context |
|
| 114 | - * |
|
| 115 | - * @return void |
|
| 116 | - */ |
|
| 117 | - public function info($message, array $context = array()) |
|
| 118 | - { |
|
| 119 | - $this->log(LogLevel::INFO, $message, $context); |
|
| 120 | - } |
|
| 107 | + /** |
|
| 108 | + * Interesting events. |
|
| 109 | + * |
|
| 110 | + * Example: User logs in, SQL logs. |
|
| 111 | + * |
|
| 112 | + * @param string $message |
|
| 113 | + * @param mixed[] $context |
|
| 114 | + * |
|
| 115 | + * @return void |
|
| 116 | + */ |
|
| 117 | + public function info($message, array $context = array()) |
|
| 118 | + { |
|
| 119 | + $this->log(LogLevel::INFO, $message, $context); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Detailed debug information. |
|
| 124 | - * |
|
| 125 | - * @param string $message |
|
| 126 | - * @param mixed[] $context |
|
| 127 | - * |
|
| 128 | - * @return void |
|
| 129 | - */ |
|
| 130 | - public function debug($message, array $context = array()) |
|
| 131 | - { |
|
| 132 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
| 133 | - } |
|
| 122 | + /** |
|
| 123 | + * Detailed debug information. |
|
| 124 | + * |
|
| 125 | + * @param string $message |
|
| 126 | + * @param mixed[] $context |
|
| 127 | + * |
|
| 128 | + * @return void |
|
| 129 | + */ |
|
| 130 | + public function debug($message, array $context = array()) |
|
| 131 | + { |
|
| 132 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
| 133 | + } |
|
| 134 | 134 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | interface LoggerAwareInterface |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * Sets a logger instance on the object. |
|
| 18 | - * |
|
| 19 | - * @param LoggerInterface $logger |
|
| 20 | - * |
|
| 21 | - * @return void |
|
| 22 | - */ |
|
| 23 | - public function setLogger(LoggerInterface $logger); |
|
| 16 | + /** |
|
| 17 | + * Sets a logger instance on the object. |
|
| 18 | + * |
|
| 19 | + * @param LoggerInterface $logger |
|
| 20 | + * |
|
| 21 | + * @return void |
|
| 22 | + */ |
|
| 23 | + public function setLogger(LoggerInterface $logger); |
|
| 24 | 24 | } |
@@ -62,92 +62,92 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | class TestLogger extends AbstractLogger |
| 64 | 64 | { |
| 65 | - /** |
|
| 66 | - * @var array |
|
| 67 | - */ |
|
| 68 | - public $records = []; |
|
| 65 | + /** |
|
| 66 | + * @var array |
|
| 67 | + */ |
|
| 68 | + public $records = []; |
|
| 69 | 69 | |
| 70 | - public $recordsByLevel = []; |
|
| 70 | + public $recordsByLevel = []; |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @inheritdoc |
|
| 74 | - */ |
|
| 75 | - public function log($level, $message, array $context = []) |
|
| 76 | - { |
|
| 77 | - $record = [ |
|
| 78 | - 'level' => $level, |
|
| 79 | - 'message' => $message, |
|
| 80 | - 'context' => $context, |
|
| 81 | - ]; |
|
| 72 | + /** |
|
| 73 | + * @inheritdoc |
|
| 74 | + */ |
|
| 75 | + public function log($level, $message, array $context = []) |
|
| 76 | + { |
|
| 77 | + $record = [ |
|
| 78 | + 'level' => $level, |
|
| 79 | + 'message' => $message, |
|
| 80 | + 'context' => $context, |
|
| 81 | + ]; |
|
| 82 | 82 | |
| 83 | - $this->recordsByLevel[$record['level']][] = $record; |
|
| 84 | - $this->records[] = $record; |
|
| 85 | - } |
|
| 83 | + $this->recordsByLevel[$record['level']][] = $record; |
|
| 84 | + $this->records[] = $record; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - public function hasRecords($level) |
|
| 88 | - { |
|
| 89 | - return isset($this->recordsByLevel[$level]); |
|
| 90 | - } |
|
| 87 | + public function hasRecords($level) |
|
| 88 | + { |
|
| 89 | + return isset($this->recordsByLevel[$level]); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - public function hasRecord($record, $level) |
|
| 93 | - { |
|
| 94 | - if (is_string($record)) { |
|
| 95 | - $record = ['message' => $record]; |
|
| 96 | - } |
|
| 97 | - return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
| 98 | - if ($rec['message'] !== $record['message']) { |
|
| 99 | - return false; |
|
| 100 | - } |
|
| 101 | - if (isset($record['context']) && $rec['context'] !== $record['context']) { |
|
| 102 | - return false; |
|
| 103 | - } |
|
| 104 | - return true; |
|
| 105 | - }, $level); |
|
| 106 | - } |
|
| 92 | + public function hasRecord($record, $level) |
|
| 93 | + { |
|
| 94 | + if (is_string($record)) { |
|
| 95 | + $record = ['message' => $record]; |
|
| 96 | + } |
|
| 97 | + return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
| 98 | + if ($rec['message'] !== $record['message']) { |
|
| 99 | + return false; |
|
| 100 | + } |
|
| 101 | + if (isset($record['context']) && $rec['context'] !== $record['context']) { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 104 | + return true; |
|
| 105 | + }, $level); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - public function hasRecordThatContains($message, $level) |
|
| 109 | - { |
|
| 110 | - return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
| 111 | - return strpos($rec['message'], $message) !== false; |
|
| 112 | - }, $level); |
|
| 113 | - } |
|
| 108 | + public function hasRecordThatContains($message, $level) |
|
| 109 | + { |
|
| 110 | + return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
| 111 | + return strpos($rec['message'], $message) !== false; |
|
| 112 | + }, $level); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - public function hasRecordThatMatches($regex, $level) |
|
| 116 | - { |
|
| 117 | - return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
| 118 | - return preg_match($regex, $rec['message']) > 0; |
|
| 119 | - }, $level); |
|
| 120 | - } |
|
| 115 | + public function hasRecordThatMatches($regex, $level) |
|
| 116 | + { |
|
| 117 | + return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
| 118 | + return preg_match($regex, $rec['message']) > 0; |
|
| 119 | + }, $level); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - public function hasRecordThatPasses(callable $predicate, $level) |
|
| 123 | - { |
|
| 124 | - if (!isset($this->recordsByLevel[$level])) { |
|
| 125 | - return false; |
|
| 126 | - } |
|
| 127 | - foreach ($this->recordsByLevel[$level] as $i => $rec) { |
|
| 128 | - if (call_user_func($predicate, $rec, $i)) { |
|
| 129 | - return true; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - return false; |
|
| 133 | - } |
|
| 122 | + public function hasRecordThatPasses(callable $predicate, $level) |
|
| 123 | + { |
|
| 124 | + if (!isset($this->recordsByLevel[$level])) { |
|
| 125 | + return false; |
|
| 126 | + } |
|
| 127 | + foreach ($this->recordsByLevel[$level] as $i => $rec) { |
|
| 128 | + if (call_user_func($predicate, $rec, $i)) { |
|
| 129 | + return true; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + return false; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - public function __call($method, $args) |
|
| 136 | - { |
|
| 137 | - if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
|
| 138 | - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
|
| 139 | - $level = strtolower($matches[2]); |
|
| 140 | - if (method_exists($this, $genericMethod)) { |
|
| 141 | - $args[] = $level; |
|
| 142 | - return call_user_func_array([$this, $genericMethod], $args); |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
|
| 146 | - } |
|
| 135 | + public function __call($method, $args) |
|
| 136 | + { |
|
| 137 | + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
|
| 138 | + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
|
| 139 | + $level = strtolower($matches[2]); |
|
| 140 | + if (method_exists($this, $genericMethod)) { |
|
| 141 | + $args[] = $level; |
|
| 142 | + return call_user_func_array([$this, $genericMethod], $args); |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - public function reset() |
|
| 149 | - { |
|
| 150 | - $this->records = []; |
|
| 151 | - $this->recordsByLevel = []; |
|
| 152 | - } |
|
| 148 | + public function reset() |
|
| 149 | + { |
|
| 150 | + $this->records = []; |
|
| 151 | + $this->recordsByLevel = []; |
|
| 152 | + } |
|
| 153 | 153 | } |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class DummyTest |
| 19 | 19 | { |
| 20 | - public function __toString() |
|
| 21 | - { |
|
| 22 | - return 'DummyTest'; |
|
| 23 | - } |
|
| 20 | + public function __toString() |
|
| 21 | + { |
|
| 22 | + return 'DummyTest'; |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class LogLevel |
| 15 | 15 | { |
| 16 | - const EMERGENCY = 'emergency'; |
|
| 17 | - const ALERT = 'alert'; |
|
| 18 | - const CRITICAL = 'critical'; |
|
| 19 | - const ERROR = 'error'; |
|
| 20 | - const WARNING = 'warning'; |
|
| 21 | - const NOTICE = 'notice'; |
|
| 22 | - const INFO = 'info'; |
|
| 23 | - const DEBUG = 'debug'; |
|
| 16 | + const EMERGENCY = 'emergency'; |
|
| 17 | + const ALERT = 'alert'; |
|
| 18 | + const CRITICAL = 'critical'; |
|
| 19 | + const ERROR = 'error'; |
|
| 20 | + const WARNING = 'warning'; |
|
| 21 | + const NOTICE = 'notice'; |
|
| 22 | + const INFO = 'info'; |
|
| 23 | + const DEBUG = 'debug'; |
|
| 24 | 24 | } |
@@ -9,403 +9,403 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class Language |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * The language ID. |
|
| 14 | - * |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - public $id; |
|
| 12 | + /** |
|
| 13 | + * The language ID. |
|
| 14 | + * |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + public $id; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * The language name. |
|
| 21 | - * |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $name; |
|
| 19 | + /** |
|
| 20 | + * The language name. |
|
| 21 | + * |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $name; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * If this language is deprecated: the gettext code of the new language. |
|
| 28 | - * |
|
| 29 | - * @var string|null |
|
| 30 | - */ |
|
| 31 | - public $supersededBy; |
|
| 26 | + /** |
|
| 27 | + * If this language is deprecated: the gettext code of the new language. |
|
| 28 | + * |
|
| 29 | + * @var string|null |
|
| 30 | + */ |
|
| 31 | + public $supersededBy; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * The script name. |
|
| 35 | - * |
|
| 36 | - * @var string|null |
|
| 37 | - */ |
|
| 38 | - public $script; |
|
| 33 | + /** |
|
| 34 | + * The script name. |
|
| 35 | + * |
|
| 36 | + * @var string|null |
|
| 37 | + */ |
|
| 38 | + public $script; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * The territory name. |
|
| 42 | - * |
|
| 43 | - * @var string|null |
|
| 44 | - */ |
|
| 45 | - public $territory; |
|
| 40 | + /** |
|
| 41 | + * The territory name. |
|
| 42 | + * |
|
| 43 | + * @var string|null |
|
| 44 | + */ |
|
| 45 | + public $territory; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The name of the base language. |
|
| 49 | - * |
|
| 50 | - * @var string|null |
|
| 51 | - */ |
|
| 52 | - public $baseLanguage; |
|
| 47 | + /** |
|
| 48 | + * The name of the base language. |
|
| 49 | + * |
|
| 50 | + * @var string|null |
|
| 51 | + */ |
|
| 52 | + public $baseLanguage; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * The list of categories. |
|
| 56 | - * |
|
| 57 | - * @var \Gettext\Languages\Category[] |
|
| 58 | - */ |
|
| 59 | - public $categories; |
|
| 54 | + /** |
|
| 55 | + * The list of categories. |
|
| 56 | + * |
|
| 57 | + * @var \Gettext\Languages\Category[] |
|
| 58 | + */ |
|
| 59 | + public $categories; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * The gettext formula to decide which category should be applied. |
|
| 63 | - * |
|
| 64 | - * @var string |
|
| 65 | - */ |
|
| 66 | - public $formula; |
|
| 61 | + /** |
|
| 62 | + * The gettext formula to decide which category should be applied. |
|
| 63 | + * |
|
| 64 | + * @var string |
|
| 65 | + */ |
|
| 66 | + public $formula; |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Initialize the instance and parse the language code. |
|
| 70 | - * |
|
| 71 | - * @param array $info The result of CldrData::getLanguageInfo() |
|
| 72 | - * |
|
| 73 | - * @throws \Exception throws an Exception if $fullId is not valid |
|
| 74 | - */ |
|
| 75 | - private function __construct($info) |
|
| 76 | - { |
|
| 77 | - $this->id = $info['id']; |
|
| 78 | - $this->name = $info['name']; |
|
| 79 | - $this->supersededBy = isset($info['supersededBy']) ? $info['supersededBy'] : null; |
|
| 80 | - $this->script = isset($info['script']) ? $info['script'] : null; |
|
| 81 | - $this->territory = isset($info['territory']) ? $info['territory'] : null; |
|
| 82 | - $this->baseLanguage = isset($info['baseLanguage']) ? $info['baseLanguage'] : null; |
|
| 83 | - // Let's build the category list |
|
| 84 | - $this->categories = array(); |
|
| 85 | - foreach ($info['categories'] as $cldrCategoryId => $cldrFormulaAndExamples) { |
|
| 86 | - $category = new Category($cldrCategoryId, $cldrFormulaAndExamples); |
|
| 87 | - foreach ($this->categories as $c) { |
|
| 88 | - if ($category->id === $c->id) { |
|
| 89 | - throw new Exception("The category '{$category->id}' is specified more than once"); |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - $this->categories[] = $category; |
|
| 93 | - } |
|
| 94 | - if (empty($this->categories)) { |
|
| 95 | - throw new Exception("The language '{$info['id']}' does not have any plural category"); |
|
| 96 | - } |
|
| 97 | - // Let's sort the categories from 'zero' to 'other' |
|
| 98 | - usort($this->categories, function (Category $category1, Category $category2) { |
|
| 99 | - return array_search($category1->id, CldrData::$categories) - array_search($category2->id, CldrData::$categories); |
|
| 100 | - }); |
|
| 101 | - // The 'other' category should always be there |
|
| 102 | - if ($this->categories[count($this->categories) - 1]->id !== CldrData::OTHER_CATEGORY) { |
|
| 103 | - throw new Exception("The language '{$info['id']}' does not have the '" . CldrData::OTHER_CATEGORY . "' plural category"); |
|
| 104 | - } |
|
| 105 | - $this->checkAlwaysTrueCategories(); |
|
| 106 | - $this->checkAlwaysFalseCategories(); |
|
| 107 | - $this->checkAllCategoriesWithExamples(); |
|
| 108 | - $this->formula = $this->buildFormula(); |
|
| 109 | - } |
|
| 68 | + /** |
|
| 69 | + * Initialize the instance and parse the language code. |
|
| 70 | + * |
|
| 71 | + * @param array $info The result of CldrData::getLanguageInfo() |
|
| 72 | + * |
|
| 73 | + * @throws \Exception throws an Exception if $fullId is not valid |
|
| 74 | + */ |
|
| 75 | + private function __construct($info) |
|
| 76 | + { |
|
| 77 | + $this->id = $info['id']; |
|
| 78 | + $this->name = $info['name']; |
|
| 79 | + $this->supersededBy = isset($info['supersededBy']) ? $info['supersededBy'] : null; |
|
| 80 | + $this->script = isset($info['script']) ? $info['script'] : null; |
|
| 81 | + $this->territory = isset($info['territory']) ? $info['territory'] : null; |
|
| 82 | + $this->baseLanguage = isset($info['baseLanguage']) ? $info['baseLanguage'] : null; |
|
| 83 | + // Let's build the category list |
|
| 84 | + $this->categories = array(); |
|
| 85 | + foreach ($info['categories'] as $cldrCategoryId => $cldrFormulaAndExamples) { |
|
| 86 | + $category = new Category($cldrCategoryId, $cldrFormulaAndExamples); |
|
| 87 | + foreach ($this->categories as $c) { |
|
| 88 | + if ($category->id === $c->id) { |
|
| 89 | + throw new Exception("The category '{$category->id}' is specified more than once"); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + $this->categories[] = $category; |
|
| 93 | + } |
|
| 94 | + if (empty($this->categories)) { |
|
| 95 | + throw new Exception("The language '{$info['id']}' does not have any plural category"); |
|
| 96 | + } |
|
| 97 | + // Let's sort the categories from 'zero' to 'other' |
|
| 98 | + usort($this->categories, function (Category $category1, Category $category2) { |
|
| 99 | + return array_search($category1->id, CldrData::$categories) - array_search($category2->id, CldrData::$categories); |
|
| 100 | + }); |
|
| 101 | + // The 'other' category should always be there |
|
| 102 | + if ($this->categories[count($this->categories) - 1]->id !== CldrData::OTHER_CATEGORY) { |
|
| 103 | + throw new Exception("The language '{$info['id']}' does not have the '" . CldrData::OTHER_CATEGORY . "' plural category"); |
|
| 104 | + } |
|
| 105 | + $this->checkAlwaysTrueCategories(); |
|
| 106 | + $this->checkAlwaysFalseCategories(); |
|
| 107 | + $this->checkAllCategoriesWithExamples(); |
|
| 108 | + $this->formula = $this->buildFormula(); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Return a list of all languages available. |
|
| 113 | - * |
|
| 114 | - * @throws \Exception |
|
| 115 | - * |
|
| 116 | - * @return \Gettext\Languages\Language[] |
|
| 117 | - */ |
|
| 118 | - public static function getAll() |
|
| 119 | - { |
|
| 120 | - $result = array(); |
|
| 121 | - foreach (array_keys(CldrData::getLanguageNames()) as $cldrLanguageId) { |
|
| 122 | - $result[] = new self(CldrData::getLanguageInfo($cldrLanguageId)); |
|
| 123 | - } |
|
| 111 | + /** |
|
| 112 | + * Return a list of all languages available. |
|
| 113 | + * |
|
| 114 | + * @throws \Exception |
|
| 115 | + * |
|
| 116 | + * @return \Gettext\Languages\Language[] |
|
| 117 | + */ |
|
| 118 | + public static function getAll() |
|
| 119 | + { |
|
| 120 | + $result = array(); |
|
| 121 | + foreach (array_keys(CldrData::getLanguageNames()) as $cldrLanguageId) { |
|
| 122 | + $result[] = new self(CldrData::getLanguageInfo($cldrLanguageId)); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $result; |
|
| 126 | - } |
|
| 125 | + return $result; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Return a Language instance given the language id. |
|
| 130 | - * |
|
| 131 | - * @param string $id |
|
| 132 | - * |
|
| 133 | - * @return \Gettext\Languages\Language|null |
|
| 134 | - */ |
|
| 135 | - public static function getById($id) |
|
| 136 | - { |
|
| 137 | - $result = null; |
|
| 138 | - $info = CldrData::getLanguageInfo($id); |
|
| 139 | - if (isset($info)) { |
|
| 140 | - $result = new self($info); |
|
| 141 | - } |
|
| 128 | + /** |
|
| 129 | + * Return a Language instance given the language id. |
|
| 130 | + * |
|
| 131 | + * @param string $id |
|
| 132 | + * |
|
| 133 | + * @return \Gettext\Languages\Language|null |
|
| 134 | + */ |
|
| 135 | + public static function getById($id) |
|
| 136 | + { |
|
| 137 | + $result = null; |
|
| 138 | + $info = CldrData::getLanguageInfo($id); |
|
| 139 | + if (isset($info)) { |
|
| 140 | + $result = new self($info); |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - return $result; |
|
| 144 | - } |
|
| 143 | + return $result; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Returns a clone of this instance with all the strings to US-ASCII. |
|
| 148 | - * |
|
| 149 | - * @return \Gettext\Languages\Language |
|
| 150 | - */ |
|
| 151 | - public function getUSAsciiClone() |
|
| 152 | - { |
|
| 153 | - $clone = clone $this; |
|
| 154 | - self::asciifier($clone->name); |
|
| 155 | - self::asciifier($clone->formula); |
|
| 156 | - $clone->categories = array(); |
|
| 157 | - foreach ($this->categories as $category) { |
|
| 158 | - $categoryClone = clone $category; |
|
| 159 | - self::asciifier($categoryClone->examples); |
|
| 160 | - $clone->categories[] = $categoryClone; |
|
| 161 | - } |
|
| 146 | + /** |
|
| 147 | + * Returns a clone of this instance with all the strings to US-ASCII. |
|
| 148 | + * |
|
| 149 | + * @return \Gettext\Languages\Language |
|
| 150 | + */ |
|
| 151 | + public function getUSAsciiClone() |
|
| 152 | + { |
|
| 153 | + $clone = clone $this; |
|
| 154 | + self::asciifier($clone->name); |
|
| 155 | + self::asciifier($clone->formula); |
|
| 156 | + $clone->categories = array(); |
|
| 157 | + foreach ($this->categories as $category) { |
|
| 158 | + $categoryClone = clone $category; |
|
| 159 | + self::asciifier($categoryClone->examples); |
|
| 160 | + $clone->categories[] = $categoryClone; |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - return $clone; |
|
| 164 | - } |
|
| 163 | + return $clone; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Build the formula starting from the currently defined categories. |
|
| 168 | - * |
|
| 169 | - * @param bool $withoutParenthesis TRUE to build a formula in standard gettext format, FALSE (default) to build a PHP-compatible formula |
|
| 170 | - * |
|
| 171 | - * @return string |
|
| 172 | - */ |
|
| 173 | - public function buildFormula($withoutParenthesis = false) |
|
| 174 | - { |
|
| 175 | - $numCategories = count($this->categories); |
|
| 176 | - switch ($numCategories) { |
|
| 177 | - case 1: |
|
| 178 | - // Just one category |
|
| 179 | - return '0'; |
|
| 180 | - case 2: |
|
| 181 | - return self::reduceFormula(self::reverseFormula($this->categories[0]->formula)); |
|
| 182 | - default: |
|
| 183 | - $formula = (string) ($numCategories - 1); |
|
| 184 | - for ($i = $numCategories - 2; $i >= 0; $i--) { |
|
| 185 | - $f = self::reduceFormula($this->categories[$i]->formula); |
|
| 186 | - if (!$withoutParenthesis && !preg_match('/^\([^()]+\)$/', $f)) { |
|
| 187 | - $f = "({$f})"; |
|
| 188 | - } |
|
| 189 | - $formula = "{$f} ? {$i} : {$formula}"; |
|
| 190 | - if (!$withoutParenthesis && $i > 0) { |
|
| 191 | - $formula = "({$formula})"; |
|
| 192 | - } |
|
| 193 | - } |
|
| 166 | + /** |
|
| 167 | + * Build the formula starting from the currently defined categories. |
|
| 168 | + * |
|
| 169 | + * @param bool $withoutParenthesis TRUE to build a formula in standard gettext format, FALSE (default) to build a PHP-compatible formula |
|
| 170 | + * |
|
| 171 | + * @return string |
|
| 172 | + */ |
|
| 173 | + public function buildFormula($withoutParenthesis = false) |
|
| 174 | + { |
|
| 175 | + $numCategories = count($this->categories); |
|
| 176 | + switch ($numCategories) { |
|
| 177 | + case 1: |
|
| 178 | + // Just one category |
|
| 179 | + return '0'; |
|
| 180 | + case 2: |
|
| 181 | + return self::reduceFormula(self::reverseFormula($this->categories[0]->formula)); |
|
| 182 | + default: |
|
| 183 | + $formula = (string) ($numCategories - 1); |
|
| 184 | + for ($i = $numCategories - 2; $i >= 0; $i--) { |
|
| 185 | + $f = self::reduceFormula($this->categories[$i]->formula); |
|
| 186 | + if (!$withoutParenthesis && !preg_match('/^\([^()]+\)$/', $f)) { |
|
| 187 | + $f = "({$f})"; |
|
| 188 | + } |
|
| 189 | + $formula = "{$f} ? {$i} : {$formula}"; |
|
| 190 | + if (!$withoutParenthesis && $i > 0) { |
|
| 191 | + $formula = "({$formula})"; |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - return $formula; |
|
| 196 | - } |
|
| 197 | - } |
|
| 195 | + return $formula; |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - /** |
|
| 200 | - * Let's look for categories that will always occur. |
|
| 201 | - * This because with decimals (CLDR) we may have more cases, with integers (gettext) we have just one case. |
|
| 202 | - * If we found that (single) category we reduce the categories to that one only. |
|
| 203 | - * |
|
| 204 | - * @throws \Exception |
|
| 205 | - */ |
|
| 206 | - private function checkAlwaysTrueCategories() |
|
| 207 | - { |
|
| 208 | - $alwaysTrueCategory = null; |
|
| 209 | - foreach ($this->categories as $category) { |
|
| 210 | - if ($category->formula === true) { |
|
| 211 | - if (!isset($category->examples)) { |
|
| 212 | - throw new Exception("The category '{$category->id}' should always occur, but it does not have examples (so for CLDR it will never occur for integers!)"); |
|
| 213 | - } |
|
| 214 | - $alwaysTrueCategory = $category; |
|
| 215 | - break; |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - if (isset($alwaysTrueCategory)) { |
|
| 219 | - foreach ($this->categories as $category) { |
|
| 220 | - if (($category !== $alwaysTrueCategory) && isset($category->examples)) { |
|
| 221 | - throw new Exception("The category '{$category->id}' should never occur, but it has some examples (so for CLDR it will occur!)"); |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - $alwaysTrueCategory->id = CldrData::OTHER_CATEGORY; |
|
| 225 | - $alwaysTrueCategory->formula = null; |
|
| 226 | - $this->categories = array($alwaysTrueCategory); |
|
| 227 | - } |
|
| 228 | - } |
|
| 199 | + /** |
|
| 200 | + * Let's look for categories that will always occur. |
|
| 201 | + * This because with decimals (CLDR) we may have more cases, with integers (gettext) we have just one case. |
|
| 202 | + * If we found that (single) category we reduce the categories to that one only. |
|
| 203 | + * |
|
| 204 | + * @throws \Exception |
|
| 205 | + */ |
|
| 206 | + private function checkAlwaysTrueCategories() |
|
| 207 | + { |
|
| 208 | + $alwaysTrueCategory = null; |
|
| 209 | + foreach ($this->categories as $category) { |
|
| 210 | + if ($category->formula === true) { |
|
| 211 | + if (!isset($category->examples)) { |
|
| 212 | + throw new Exception("The category '{$category->id}' should always occur, but it does not have examples (so for CLDR it will never occur for integers!)"); |
|
| 213 | + } |
|
| 214 | + $alwaysTrueCategory = $category; |
|
| 215 | + break; |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + if (isset($alwaysTrueCategory)) { |
|
| 219 | + foreach ($this->categories as $category) { |
|
| 220 | + if (($category !== $alwaysTrueCategory) && isset($category->examples)) { |
|
| 221 | + throw new Exception("The category '{$category->id}' should never occur, but it has some examples (so for CLDR it will occur!)"); |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + $alwaysTrueCategory->id = CldrData::OTHER_CATEGORY; |
|
| 225 | + $alwaysTrueCategory->formula = null; |
|
| 226 | + $this->categories = array($alwaysTrueCategory); |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | - /** |
|
| 231 | - * Let's look for categories that will never occur. |
|
| 232 | - * This because with decimals (CLDR) we may have more cases, with integers (gettext) we have some less cases. |
|
| 233 | - * If we found those categories we strip them out. |
|
| 234 | - * |
|
| 235 | - * @throws \Exception |
|
| 236 | - */ |
|
| 237 | - private function checkAlwaysFalseCategories() |
|
| 238 | - { |
|
| 239 | - $filtered = array(); |
|
| 240 | - foreach ($this->categories as $category) { |
|
| 241 | - if ($category->formula === false) { |
|
| 242 | - if (isset($category->examples)) { |
|
| 243 | - throw new Exception("The category '{$category->id}' should never occur, but it has examples (so for CLDR it may occur!)"); |
|
| 244 | - } |
|
| 245 | - } else { |
|
| 246 | - $filtered[] = $category; |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - $this->categories = $filtered; |
|
| 250 | - } |
|
| 230 | + /** |
|
| 231 | + * Let's look for categories that will never occur. |
|
| 232 | + * This because with decimals (CLDR) we may have more cases, with integers (gettext) we have some less cases. |
|
| 233 | + * If we found those categories we strip them out. |
|
| 234 | + * |
|
| 235 | + * @throws \Exception |
|
| 236 | + */ |
|
| 237 | + private function checkAlwaysFalseCategories() |
|
| 238 | + { |
|
| 239 | + $filtered = array(); |
|
| 240 | + foreach ($this->categories as $category) { |
|
| 241 | + if ($category->formula === false) { |
|
| 242 | + if (isset($category->examples)) { |
|
| 243 | + throw new Exception("The category '{$category->id}' should never occur, but it has examples (so for CLDR it may occur!)"); |
|
| 244 | + } |
|
| 245 | + } else { |
|
| 246 | + $filtered[] = $category; |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + $this->categories = $filtered; |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Let's look for categories that don't have examples. |
|
| 254 | - * This because with decimals (CLDR) we may have more cases, with integers (gettext) we have some less cases. |
|
| 255 | - * If we found those categories, we check that they never occur and we strip them out. |
|
| 256 | - * |
|
| 257 | - * @throws \Exception |
|
| 258 | - */ |
|
| 259 | - private function checkAllCategoriesWithExamples() |
|
| 260 | - { |
|
| 261 | - $allCategoriesIds = array(); |
|
| 262 | - $goodCategories = array(); |
|
| 263 | - $badCategories = array(); |
|
| 264 | - $badCategoriesIds = array(); |
|
| 265 | - foreach ($this->categories as $category) { |
|
| 266 | - $allCategoriesIds[] = $category->id; |
|
| 267 | - if (isset($category->examples)) { |
|
| 268 | - $goodCategories[] = $category; |
|
| 269 | - } else { |
|
| 270 | - $badCategories[] = $category; |
|
| 271 | - $badCategoriesIds[] = $category->id; |
|
| 272 | - } |
|
| 273 | - } |
|
| 274 | - if (empty($badCategories)) { |
|
| 275 | - return; |
|
| 276 | - } |
|
| 277 | - $removeCategoriesWithoutExamples = false; |
|
| 278 | - switch (implode(',', $badCategoriesIds) . '@' . implode(',', $allCategoriesIds)) { |
|
| 279 | - case CldrData::OTHER_CATEGORY . '@one,few,many,' . CldrData::OTHER_CATEGORY: |
|
| 280 | - switch ($this->buildFormula()) { |
|
| 281 | - case '(n % 10 == 1 && n % 100 != 11) ? 0 : ((n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) ? 1 : ((n % 10 == 0 || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 11 && n % 100 <= 14) ? 2 : 3))': |
|
| 282 | - // Numbers ending with 0 => case 2 ('many') |
|
| 283 | - // Numbers ending with 1 but not with 11 => case 0 ('one') |
|
| 284 | - // Numbers ending with 11 => case 2 ('many') |
|
| 285 | - // Numbers ending with 2 but not with 12 => case 1 ('few') |
|
| 286 | - // Numbers ending with 12 => case 2 ('many') |
|
| 287 | - // Numbers ending with 3 but not with 13 => case 1 ('few') |
|
| 288 | - // Numbers ending with 13 => case 2 ('many') |
|
| 289 | - // Numbers ending with 4 but not with 14 => case 1 ('few') |
|
| 290 | - // Numbers ending with 14 => case 2 ('many') |
|
| 291 | - // Numbers ending with 5 => case 2 ('many') |
|
| 292 | - // Numbers ending with 6 => case 2 ('many') |
|
| 293 | - // Numbers ending with 7 => case 2 ('many') |
|
| 294 | - // Numbers ending with 8 => case 2 ('many') |
|
| 295 | - // Numbers ending with 9 => case 2 ('many') |
|
| 296 | - // => the 'other' case never occurs: use 'other' for 'many' |
|
| 297 | - $removeCategoriesWithoutExamples = true; |
|
| 298 | - break; |
|
| 299 | - case '(n == 1) ? 0 : ((n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) ? 1 : ((n != 1 && (n % 10 == 0 || n % 10 == 1) || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 12 && n % 100 <= 14) ? 2 : 3))': |
|
| 300 | - // Numbers ending with 0 => case 2 ('many') |
|
| 301 | - // Numbers ending with 1 but not number 1 => case 2 ('many') |
|
| 302 | - // Number 1 => case 0 ('one') |
|
| 303 | - // Numbers ending with 2 but not with 12 => case 1 ('few') |
|
| 304 | - // Numbers ending with 12 => case 2 ('many') |
|
| 305 | - // Numbers ending with 3 but not with 13 => case 1 ('few') |
|
| 306 | - // Numbers ending with 13 => case 2 ('many') |
|
| 307 | - // Numbers ending with 4 but not with 14 => case 1 ('few') |
|
| 308 | - // Numbers ending with 14 => case 2 ('many') |
|
| 309 | - // Numbers ending with 5 => case 2 ('many') |
|
| 310 | - // Numbers ending with 6 => case 2 ('many') |
|
| 311 | - // Numbers ending with 7 => case 2 ('many') |
|
| 312 | - // Numbers ending with 8 => case 2 ('many') |
|
| 313 | - // Numbers ending with 9 => case 2 ('many') |
|
| 314 | - // => the 'other' case never occurs: use 'other' for 'many' |
|
| 315 | - $removeCategoriesWithoutExamples = true; |
|
| 316 | - break; |
|
| 317 | - } |
|
| 318 | - } |
|
| 319 | - if (!$removeCategoriesWithoutExamples) { |
|
| 320 | - throw new Exception("Unhandled case of plural categories without examples '" . implode(', ', $badCategoriesIds) . "' out of '" . implode(', ', $allCategoriesIds) . "'"); |
|
| 321 | - } |
|
| 322 | - if ($badCategories[count($badCategories) - 1]->id === CldrData::OTHER_CATEGORY) { |
|
| 323 | - // We're removing the 'other' cagory: let's change the last good category to 'other' |
|
| 324 | - $lastGood = $goodCategories[count($goodCategories) - 1]; |
|
| 325 | - $lastGood->id = CldrData::OTHER_CATEGORY; |
|
| 326 | - $lastGood->formula = null; |
|
| 327 | - } |
|
| 328 | - $this->categories = $goodCategories; |
|
| 329 | - } |
|
| 252 | + /** |
|
| 253 | + * Let's look for categories that don't have examples. |
|
| 254 | + * This because with decimals (CLDR) we may have more cases, with integers (gettext) we have some less cases. |
|
| 255 | + * If we found those categories, we check that they never occur and we strip them out. |
|
| 256 | + * |
|
| 257 | + * @throws \Exception |
|
| 258 | + */ |
|
| 259 | + private function checkAllCategoriesWithExamples() |
|
| 260 | + { |
|
| 261 | + $allCategoriesIds = array(); |
|
| 262 | + $goodCategories = array(); |
|
| 263 | + $badCategories = array(); |
|
| 264 | + $badCategoriesIds = array(); |
|
| 265 | + foreach ($this->categories as $category) { |
|
| 266 | + $allCategoriesIds[] = $category->id; |
|
| 267 | + if (isset($category->examples)) { |
|
| 268 | + $goodCategories[] = $category; |
|
| 269 | + } else { |
|
| 270 | + $badCategories[] = $category; |
|
| 271 | + $badCategoriesIds[] = $category->id; |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | + if (empty($badCategories)) { |
|
| 275 | + return; |
|
| 276 | + } |
|
| 277 | + $removeCategoriesWithoutExamples = false; |
|
| 278 | + switch (implode(',', $badCategoriesIds) . '@' . implode(',', $allCategoriesIds)) { |
|
| 279 | + case CldrData::OTHER_CATEGORY . '@one,few,many,' . CldrData::OTHER_CATEGORY: |
|
| 280 | + switch ($this->buildFormula()) { |
|
| 281 | + case '(n % 10 == 1 && n % 100 != 11) ? 0 : ((n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) ? 1 : ((n % 10 == 0 || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 11 && n % 100 <= 14) ? 2 : 3))': |
|
| 282 | + // Numbers ending with 0 => case 2 ('many') |
|
| 283 | + // Numbers ending with 1 but not with 11 => case 0 ('one') |
|
| 284 | + // Numbers ending with 11 => case 2 ('many') |
|
| 285 | + // Numbers ending with 2 but not with 12 => case 1 ('few') |
|
| 286 | + // Numbers ending with 12 => case 2 ('many') |
|
| 287 | + // Numbers ending with 3 but not with 13 => case 1 ('few') |
|
| 288 | + // Numbers ending with 13 => case 2 ('many') |
|
| 289 | + // Numbers ending with 4 but not with 14 => case 1 ('few') |
|
| 290 | + // Numbers ending with 14 => case 2 ('many') |
|
| 291 | + // Numbers ending with 5 => case 2 ('many') |
|
| 292 | + // Numbers ending with 6 => case 2 ('many') |
|
| 293 | + // Numbers ending with 7 => case 2 ('many') |
|
| 294 | + // Numbers ending with 8 => case 2 ('many') |
|
| 295 | + // Numbers ending with 9 => case 2 ('many') |
|
| 296 | + // => the 'other' case never occurs: use 'other' for 'many' |
|
| 297 | + $removeCategoriesWithoutExamples = true; |
|
| 298 | + break; |
|
| 299 | + case '(n == 1) ? 0 : ((n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) ? 1 : ((n != 1 && (n % 10 == 0 || n % 10 == 1) || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 12 && n % 100 <= 14) ? 2 : 3))': |
|
| 300 | + // Numbers ending with 0 => case 2 ('many') |
|
| 301 | + // Numbers ending with 1 but not number 1 => case 2 ('many') |
|
| 302 | + // Number 1 => case 0 ('one') |
|
| 303 | + // Numbers ending with 2 but not with 12 => case 1 ('few') |
|
| 304 | + // Numbers ending with 12 => case 2 ('many') |
|
| 305 | + // Numbers ending with 3 but not with 13 => case 1 ('few') |
|
| 306 | + // Numbers ending with 13 => case 2 ('many') |
|
| 307 | + // Numbers ending with 4 but not with 14 => case 1 ('few') |
|
| 308 | + // Numbers ending with 14 => case 2 ('many') |
|
| 309 | + // Numbers ending with 5 => case 2 ('many') |
|
| 310 | + // Numbers ending with 6 => case 2 ('many') |
|
| 311 | + // Numbers ending with 7 => case 2 ('many') |
|
| 312 | + // Numbers ending with 8 => case 2 ('many') |
|
| 313 | + // Numbers ending with 9 => case 2 ('many') |
|
| 314 | + // => the 'other' case never occurs: use 'other' for 'many' |
|
| 315 | + $removeCategoriesWithoutExamples = true; |
|
| 316 | + break; |
|
| 317 | + } |
|
| 318 | + } |
|
| 319 | + if (!$removeCategoriesWithoutExamples) { |
|
| 320 | + throw new Exception("Unhandled case of plural categories without examples '" . implode(', ', $badCategoriesIds) . "' out of '" . implode(', ', $allCategoriesIds) . "'"); |
|
| 321 | + } |
|
| 322 | + if ($badCategories[count($badCategories) - 1]->id === CldrData::OTHER_CATEGORY) { |
|
| 323 | + // We're removing the 'other' cagory: let's change the last good category to 'other' |
|
| 324 | + $lastGood = $goodCategories[count($goodCategories) - 1]; |
|
| 325 | + $lastGood->id = CldrData::OTHER_CATEGORY; |
|
| 326 | + $lastGood->formula = null; |
|
| 327 | + } |
|
| 328 | + $this->categories = $goodCategories; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - /** |
|
| 332 | - * Reverse a formula. |
|
| 333 | - * |
|
| 334 | - * @param string $formula |
|
| 335 | - * |
|
| 336 | - * @throws \Exception |
|
| 337 | - * |
|
| 338 | - * @return string |
|
| 339 | - */ |
|
| 340 | - private static function reverseFormula($formula) |
|
| 341 | - { |
|
| 342 | - if (preg_match('/^n( % \d+)? == \d+(\.\.\d+|,\d+)*?$/', $formula)) { |
|
| 343 | - return str_replace(' == ', ' != ', $formula); |
|
| 344 | - } |
|
| 345 | - if (preg_match('/^n( % \d+)? != \d+(\.\.\d+|,\d+)*?$/', $formula)) { |
|
| 346 | - return str_replace(' != ', ' == ', $formula); |
|
| 347 | - } |
|
| 348 | - if (preg_match('/^\(?n == \d+ \|\| n == \d+\)?$/', $formula)) { |
|
| 349 | - return trim(str_replace(array(' == ', ' || '), array(' != ', ' && '), $formula), '()'); |
|
| 350 | - } |
|
| 351 | - $m = null; |
|
| 352 | - if (preg_match('/^(n(?: % \d+)?) == (\d+) && (n(?: % \d+)?) != (\d+)$/', $formula, $m)) { |
|
| 353 | - return "{$m[1]} != {$m[2]} || {$m[3]} == {$m[4]}"; |
|
| 354 | - } |
|
| 355 | - switch ($formula) { |
|
| 356 | - case '(n == 1 || n == 2 || n == 3) || n % 10 != 4 && n % 10 != 6 && n % 10 != 9': |
|
| 357 | - return 'n != 1 && n != 2 && n != 3 && (n % 10 == 4 || n % 10 == 6 || n % 10 == 9)'; |
|
| 358 | - case '(n == 0 || n == 1) || n >= 11 && n <= 99': |
|
| 359 | - return 'n >= 2 && (n < 11 || n > 99)'; |
|
| 360 | - } |
|
| 361 | - throw new Exception("Unable to reverse the formula '{$formula}'"); |
|
| 362 | - } |
|
| 331 | + /** |
|
| 332 | + * Reverse a formula. |
|
| 333 | + * |
|
| 334 | + * @param string $formula |
|
| 335 | + * |
|
| 336 | + * @throws \Exception |
|
| 337 | + * |
|
| 338 | + * @return string |
|
| 339 | + */ |
|
| 340 | + private static function reverseFormula($formula) |
|
| 341 | + { |
|
| 342 | + if (preg_match('/^n( % \d+)? == \d+(\.\.\d+|,\d+)*?$/', $formula)) { |
|
| 343 | + return str_replace(' == ', ' != ', $formula); |
|
| 344 | + } |
|
| 345 | + if (preg_match('/^n( % \d+)? != \d+(\.\.\d+|,\d+)*?$/', $formula)) { |
|
| 346 | + return str_replace(' != ', ' == ', $formula); |
|
| 347 | + } |
|
| 348 | + if (preg_match('/^\(?n == \d+ \|\| n == \d+\)?$/', $formula)) { |
|
| 349 | + return trim(str_replace(array(' == ', ' || '), array(' != ', ' && '), $formula), '()'); |
|
| 350 | + } |
|
| 351 | + $m = null; |
|
| 352 | + if (preg_match('/^(n(?: % \d+)?) == (\d+) && (n(?: % \d+)?) != (\d+)$/', $formula, $m)) { |
|
| 353 | + return "{$m[1]} != {$m[2]} || {$m[3]} == {$m[4]}"; |
|
| 354 | + } |
|
| 355 | + switch ($formula) { |
|
| 356 | + case '(n == 1 || n == 2 || n == 3) || n % 10 != 4 && n % 10 != 6 && n % 10 != 9': |
|
| 357 | + return 'n != 1 && n != 2 && n != 3 && (n % 10 == 4 || n % 10 == 6 || n % 10 == 9)'; |
|
| 358 | + case '(n == 0 || n == 1) || n >= 11 && n <= 99': |
|
| 359 | + return 'n >= 2 && (n < 11 || n > 99)'; |
|
| 360 | + } |
|
| 361 | + throw new Exception("Unable to reverse the formula '{$formula}'"); |
|
| 362 | + } |
|
| 363 | 363 | |
| 364 | - /** |
|
| 365 | - * Reduce some excessively complex formulas. |
|
| 366 | - * |
|
| 367 | - * @param string $formula |
|
| 368 | - * |
|
| 369 | - * @return string |
|
| 370 | - */ |
|
| 371 | - private static function reduceFormula($formula) |
|
| 372 | - { |
|
| 373 | - $map = array( |
|
| 374 | - 'n != 0 && n != 1' => 'n > 1', |
|
| 375 | - '(n == 0 || n == 1) && n != 0' => 'n == 1', |
|
| 376 | - ); |
|
| 364 | + /** |
|
| 365 | + * Reduce some excessively complex formulas. |
|
| 366 | + * |
|
| 367 | + * @param string $formula |
|
| 368 | + * |
|
| 369 | + * @return string |
|
| 370 | + */ |
|
| 371 | + private static function reduceFormula($formula) |
|
| 372 | + { |
|
| 373 | + $map = array( |
|
| 374 | + 'n != 0 && n != 1' => 'n > 1', |
|
| 375 | + '(n == 0 || n == 1) && n != 0' => 'n == 1', |
|
| 376 | + ); |
|
| 377 | 377 | |
| 378 | - return isset($map[$formula]) ? $map[$formula] : $formula; |
|
| 379 | - } |
|
| 378 | + return isset($map[$formula]) ? $map[$formula] : $formula; |
|
| 379 | + } |
|
| 380 | 380 | |
| 381 | - /** |
|
| 382 | - * Take one variable and, if it's a string, we transliterate it to US-ASCII. |
|
| 383 | - * |
|
| 384 | - * @param mixed $value the variable to work on |
|
| 385 | - * |
|
| 386 | - * @throws \Exception |
|
| 387 | - */ |
|
| 388 | - private static function asciifier(&$value) |
|
| 389 | - { |
|
| 390 | - if (is_string($value) && $value !== '') { |
|
| 391 | - // Avoid converting from 'Ÿ' to '"Y', let's prefer 'Y' |
|
| 392 | - $value = strtr($value, array( |
|
| 393 | - 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', |
|
| 394 | - 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', |
|
| 395 | - 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', |
|
| 396 | - 'Ñ' => 'N', |
|
| 397 | - 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', |
|
| 398 | - 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', |
|
| 399 | - 'Ÿ' => 'Y', 'Ý' => 'Y', |
|
| 400 | - 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', |
|
| 401 | - 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', |
|
| 402 | - 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', |
|
| 403 | - 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', |
|
| 404 | - 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', |
|
| 405 | - 'ý' => 'y', 'ÿ' => 'y', |
|
| 406 | - '…' => '...', |
|
| 407 | - 'ʼ' => "'", '’' => "'", |
|
| 408 | - )); |
|
| 409 | - } |
|
| 410 | - } |
|
| 381 | + /** |
|
| 382 | + * Take one variable and, if it's a string, we transliterate it to US-ASCII. |
|
| 383 | + * |
|
| 384 | + * @param mixed $value the variable to work on |
|
| 385 | + * |
|
| 386 | + * @throws \Exception |
|
| 387 | + */ |
|
| 388 | + private static function asciifier(&$value) |
|
| 389 | + { |
|
| 390 | + if (is_string($value) && $value !== '') { |
|
| 391 | + // Avoid converting from 'Ÿ' to '"Y', let's prefer 'Y' |
|
| 392 | + $value = strtr($value, array( |
|
| 393 | + 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', |
|
| 394 | + 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', |
|
| 395 | + 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', |
|
| 396 | + 'Ñ' => 'N', |
|
| 397 | + 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', |
|
| 398 | + 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', |
|
| 399 | + 'Ÿ' => 'Y', 'Ý' => 'Y', |
|
| 400 | + 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', |
|
| 401 | + 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', |
|
| 402 | + 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', |
|
| 403 | + 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', |
|
| 404 | + 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', |
|
| 405 | + 'ý' => 'y', 'ÿ' => 'y', |
|
| 406 | + '…' => '...', |
|
| 407 | + 'ʼ' => "'", '’' => "'", |
|
| 408 | + )); |
|
| 409 | + } |
|
| 410 | + } |
|
| 411 | 411 | } |