@@ -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 | } |
@@ -11,133 +11,133 @@ |
||
11 | 11 | |
12 | 12 | use Symfony\Polyfill\Mbstring as p; |
13 | 13 | |
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); } |
|
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 ); } |
|
16 | 16 | } |
17 | -if (!function_exists('mb_decode_mimeheader')) { |
|
18 | - function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } |
|
17 | +if ( ! function_exists( 'mb_decode_mimeheader' ) ) { |
|
18 | + function mb_decode_mimeheader( ?string $string ): string { return p\Mbstring::mb_decode_mimeheader( (string)$string ); } |
|
19 | 19 | } |
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); } |
|
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 ); } |
|
22 | 22 | } |
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); } |
|
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 ); } |
|
25 | 25 | } |
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); } |
|
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 ); } |
|
28 | 28 | } |
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); } |
|
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 ); } |
|
31 | 31 | } |
32 | -if (!function_exists('mb_internal_encoding')) { |
|
33 | - function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } |
|
32 | +if ( ! function_exists( 'mb_internal_encoding' ) ) { |
|
33 | + function mb_internal_encoding( ?string $encoding = null ): string | bool { return p\Mbstring::mb_internal_encoding( $encoding ); } |
|
34 | 34 | } |
35 | -if (!function_exists('mb_language')) { |
|
36 | - function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } |
|
35 | +if ( ! function_exists( 'mb_language' ) ) { |
|
36 | + function mb_language( ?string $language = null ): string | bool { return p\Mbstring::mb_language( $language ); } |
|
37 | 37 | } |
38 | -if (!function_exists('mb_list_encodings')) { |
|
38 | +if ( ! function_exists( 'mb_list_encodings' ) ) { |
|
39 | 39 | function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } |
40 | 40 | } |
41 | -if (!function_exists('mb_encoding_aliases')) { |
|
42 | - function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } |
|
41 | +if ( ! function_exists( 'mb_encoding_aliases' ) ) { |
|
42 | + function mb_encoding_aliases( ?string $encoding ): array { return p\Mbstring::mb_encoding_aliases( (string)$encoding ); } |
|
43 | 43 | } |
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); } |
|
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 ); } |
|
46 | 46 | } |
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); } |
|
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 ); } |
|
49 | 49 | } |
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); } |
|
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 ); } |
|
52 | 52 | } |
53 | -if (!function_exists('mb_parse_str')) { |
|
54 | - function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } |
|
53 | +if ( ! function_exists( 'mb_parse_str' ) ) { |
|
54 | + function mb_parse_str( ?string $string, &$result = [ ] ): bool { parse_str( (string)$string, $result ); return (bool)$result; } |
|
55 | 55 | } |
56 | -if (!function_exists('mb_strlen')) { |
|
57 | - function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } |
|
56 | +if ( ! function_exists( 'mb_strlen' ) ) { |
|
57 | + function mb_strlen( ?string $string, ?string $encoding = null ): int { return p\Mbstring::mb_strlen( (string)$string, $encoding ); } |
|
58 | 58 | } |
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); } |
|
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 ); } |
|
61 | 61 | } |
62 | -if (!function_exists('mb_strtolower')) { |
|
63 | - function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } |
|
62 | +if ( ! function_exists( 'mb_strtolower' ) ) { |
|
63 | + function mb_strtolower( ?string $string, ?string $encoding = null ): string { return p\Mbstring::mb_strtolower( (string)$string, $encoding ); } |
|
64 | 64 | } |
65 | -if (!function_exists('mb_strtoupper')) { |
|
66 | - function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } |
|
65 | +if ( ! function_exists( 'mb_strtoupper' ) ) { |
|
66 | + function mb_strtoupper( ?string $string, ?string $encoding = null ): string { return p\Mbstring::mb_strtoupper( (string)$string, $encoding ); } |
|
67 | 67 | } |
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); } |
|
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 ); } |
|
70 | 70 | } |
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); } |
|
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 ); } |
|
73 | 73 | } |
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); } |
|
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 ); } |
|
76 | 76 | } |
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); } |
|
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 ); } |
|
79 | 79 | } |
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); } |
|
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 ); } |
|
82 | 82 | } |
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); } |
|
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 ); } |
|
85 | 85 | } |
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); } |
|
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 ); } |
|
88 | 88 | } |
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); } |
|
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 ); } |
|
91 | 91 | } |
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); } |
|
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 ); } |
|
94 | 94 | } |
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); } |
|
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 ); } |
|
97 | 97 | } |
98 | -if (!function_exists('mb_http_output')) { |
|
99 | - function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } |
|
98 | +if ( ! function_exists( 'mb_http_output' ) ) { |
|
99 | + function mb_http_output( ?string $encoding = null ): string | bool { return p\Mbstring::mb_http_output( $encoding ); } |
|
100 | 100 | } |
101 | -if (!function_exists('mb_strwidth')) { |
|
102 | - function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } |
|
101 | +if ( ! function_exists( 'mb_strwidth' ) ) { |
|
102 | + function mb_strwidth( ?string $string, ?string $encoding = null ): int { return p\Mbstring::mb_strwidth( (string)$string, $encoding ); } |
|
103 | 103 | } |
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); } |
|
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 ); } |
|
106 | 106 | } |
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); } |
|
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 ); } |
|
109 | 109 | } |
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); } |
|
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 ); } |
|
112 | 112 | } |
113 | 113 | |
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); } |
|
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 ); } |
|
116 | 116 | } |
117 | 117 | |
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); } |
|
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 ); } |
|
120 | 120 | } |
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); } |
|
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 ); } |
|
123 | 123 | } |
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); } |
|
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 ); } |
|
126 | 126 | } |
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); } |
|
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 ); } |
|
129 | 129 | } |
130 | 130 | |
131 | -if (extension_loaded('mbstring')) { |
|
131 | +if ( extension_loaded( 'mbstring' ) ) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | -if (!defined('MB_CASE_UPPER')) { |
|
136 | - define('MB_CASE_UPPER', 0); |
|
135 | +if ( ! defined( 'MB_CASE_UPPER' ) ) { |
|
136 | + define( 'MB_CASE_UPPER', 0 ); |
|
137 | 137 | } |
138 | -if (!defined('MB_CASE_LOWER')) { |
|
139 | - define('MB_CASE_LOWER', 1); |
|
138 | +if ( ! defined( 'MB_CASE_LOWER' ) ) { |
|
139 | + define( 'MB_CASE_LOWER', 1 ); |
|
140 | 140 | } |
141 | -if (!defined('MB_CASE_TITLE')) { |
|
142 | - define('MB_CASE_TITLE', 2); |
|
141 | +if ( ! defined( 'MB_CASE_TITLE' ) ) { |
|
142 | + define( 'MB_CASE_TITLE', 2 ); |
|
143 | 143 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | 'a' => 'A', |
5 | 5 | 'b' => 'B', |
6 | 6 | 'c' => 'C', |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | 'A' => 'a', |
5 | 5 | 'B' => 'b', |
6 | 6 | 'C' => 'c', |
@@ -12,12 +12,12 @@ |
||
12 | 12 | use Symfony\Polyfill\Intl\Normalizer 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('normalizer_is_normalized')) { |
19 | - function normalizer_is_normalized($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::isNormalized($string, $form); } |
|
19 | + function normalizer_is_normalized($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::isNormalized($string, $form); } |
|
20 | 20 | } |
21 | 21 | if (!function_exists('normalizer_normalize')) { |
22 | - function normalizer_normalize($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::normalize($string, $form); } |
|
22 | + function normalizer_normalize($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::normalize($string, $form); } |
|
23 | 23 | } |
@@ -11,13 +11,13 @@ |
||
11 | 11 | |
12 | 12 | use Symfony\Polyfill\Intl\Normalizer as p; |
13 | 13 | |
14 | -if (\PHP_VERSION_ID >= 80000) { |
|
15 | - return require __DIR__.'/bootstrap80.php'; |
|
14 | +if ( \PHP_VERSION_ID >= 80000 ) { |
|
15 | + return require __DIR__ . '/bootstrap80.php'; |
|
16 | 16 | } |
17 | 17 | |
18 | -if (!function_exists('normalizer_is_normalized')) { |
|
19 | - function normalizer_is_normalized($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::isNormalized($string, $form); } |
|
18 | +if ( ! function_exists( 'normalizer_is_normalized' ) ) { |
|
19 | + function normalizer_is_normalized( $string, $form = p\Normalizer::FORM_C ) { return p\Normalizer::isNormalized( $string, $form ); } |
|
20 | 20 | } |
21 | -if (!function_exists('normalizer_normalize')) { |
|
22 | - function normalizer_normalize($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::normalize($string, $form); } |
|
21 | +if ( ! function_exists( 'normalizer_normalize' ) ) { |
|
22 | + function normalizer_normalize( $string, $form = p\Normalizer::FORM_C ) { return p\Normalizer::normalize( $string, $form ); } |
|
23 | 23 | } |
@@ -23,288 +23,288 @@ |
||
23 | 23 | */ |
24 | 24 | class Normalizer |
25 | 25 | { |
26 | - public const FORM_D = \Normalizer::FORM_D; |
|
27 | - public const FORM_KD = \Normalizer::FORM_KD; |
|
28 | - public const FORM_C = \Normalizer::FORM_C; |
|
29 | - public const FORM_KC = \Normalizer::FORM_KC; |
|
30 | - public const NFD = \Normalizer::NFD; |
|
31 | - public const NFKD = \Normalizer::NFKD; |
|
32 | - public const NFC = \Normalizer::NFC; |
|
33 | - public const NFKC = \Normalizer::NFKC; |
|
34 | - |
|
35 | - private static $C; |
|
36 | - private static $D; |
|
37 | - private static $KD; |
|
38 | - private static $cC; |
|
39 | - private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; |
|
40 | - private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
|
41 | - |
|
42 | - public static function isNormalized(string $s, int $form = self::FORM_C) |
|
43 | - { |
|
44 | - if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) { |
|
45 | - return false; |
|
46 | - } |
|
47 | - if (!isset($s[strspn($s, self::$ASCII)])) { |
|
48 | - return true; |
|
49 | - } |
|
50 | - if (self::NFC == $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) { |
|
51 | - return true; |
|
52 | - } |
|
53 | - |
|
54 | - return self::normalize($s, $form) === $s; |
|
55 | - } |
|
56 | - |
|
57 | - public static function normalize(string $s, int $form = self::FORM_C) |
|
58 | - { |
|
59 | - if (!preg_match('//u', $s)) { |
|
60 | - return false; |
|
61 | - } |
|
62 | - |
|
63 | - switch ($form) { |
|
64 | - case self::NFC: $C = true; $K = false; break; |
|
65 | - case self::NFD: $C = false; $K = false; break; |
|
66 | - case self::NFKC: $C = true; $K = true; break; |
|
67 | - case self::NFKD: $C = false; $K = true; break; |
|
68 | - default: |
|
69 | - if (\defined('Normalizer::NONE') && \Normalizer::NONE == $form) { |
|
70 | - return $s; |
|
71 | - } |
|
72 | - |
|
73 | - if (80000 > \PHP_VERSION_ID) { |
|
74 | - return false; |
|
75 | - } |
|
76 | - |
|
77 | - throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form'); |
|
78 | - } |
|
79 | - |
|
80 | - if ('' === $s) { |
|
81 | - return ''; |
|
82 | - } |
|
83 | - |
|
84 | - if ($K && null === self::$KD) { |
|
85 | - self::$KD = self::getData('compatibilityDecomposition'); |
|
86 | - } |
|
87 | - |
|
88 | - if (null === self::$D) { |
|
89 | - self::$D = self::getData('canonicalDecomposition'); |
|
90 | - self::$cC = self::getData('combiningClass'); |
|
91 | - } |
|
92 | - |
|
93 | - if (null !== $mbEncoding = (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) ? mb_internal_encoding() : null) { |
|
94 | - mb_internal_encoding('8bit'); |
|
95 | - } |
|
96 | - |
|
97 | - $r = self::decompose($s, $K); |
|
98 | - |
|
99 | - if ($C) { |
|
100 | - if (null === self::$C) { |
|
101 | - self::$C = self::getData('canonicalComposition'); |
|
102 | - } |
|
103 | - |
|
104 | - $r = self::recompose($r); |
|
105 | - } |
|
106 | - if (null !== $mbEncoding) { |
|
107 | - mb_internal_encoding($mbEncoding); |
|
108 | - } |
|
109 | - |
|
110 | - return $r; |
|
111 | - } |
|
112 | - |
|
113 | - private static function recompose($s) |
|
114 | - { |
|
115 | - $ASCII = self::$ASCII; |
|
116 | - $compMap = self::$C; |
|
117 | - $combClass = self::$cC; |
|
118 | - $ulenMask = self::$ulenMask; |
|
119 | - |
|
120 | - $result = $tail = ''; |
|
121 | - |
|
122 | - $i = $s[0] < "\x80" ? 1 : $ulenMask[$s[0] & "\xF0"]; |
|
123 | - $len = \strlen($s); |
|
124 | - |
|
125 | - $lastUchr = substr($s, 0, $i); |
|
126 | - $lastUcls = isset($combClass[$lastUchr]) ? 256 : 0; |
|
127 | - |
|
128 | - while ($i < $len) { |
|
129 | - if ($s[$i] < "\x80") { |
|
130 | - // ASCII chars |
|
131 | - |
|
132 | - if ($tail) { |
|
133 | - $lastUchr .= $tail; |
|
134 | - $tail = ''; |
|
135 | - } |
|
136 | - |
|
137 | - if ($j = strspn($s, $ASCII, $i + 1)) { |
|
138 | - $lastUchr .= substr($s, $i, $j); |
|
139 | - $i += $j; |
|
140 | - } |
|
141 | - |
|
142 | - $result .= $lastUchr; |
|
143 | - $lastUchr = $s[$i]; |
|
144 | - $lastUcls = 0; |
|
145 | - ++$i; |
|
146 | - continue; |
|
147 | - } |
|
148 | - |
|
149 | - $ulen = $ulenMask[$s[$i] & "\xF0"]; |
|
150 | - $uchr = substr($s, $i, $ulen); |
|
151 | - |
|
152 | - if ($lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr |
|
153 | - || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr |
|
154 | - || $lastUcls) { |
|
155 | - // Table lookup and combining chars composition |
|
156 | - |
|
157 | - $ucls = $combClass[$uchr] ?? 0; |
|
158 | - |
|
159 | - if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) { |
|
160 | - $lastUchr = $compMap[$lastUchr.$uchr]; |
|
161 | - } elseif ($lastUcls = $ucls) { |
|
162 | - $tail .= $uchr; |
|
163 | - } else { |
|
164 | - if ($tail) { |
|
165 | - $lastUchr .= $tail; |
|
166 | - $tail = ''; |
|
167 | - } |
|
168 | - |
|
169 | - $result .= $lastUchr; |
|
170 | - $lastUchr = $uchr; |
|
171 | - } |
|
172 | - } else { |
|
173 | - // Hangul chars |
|
174 | - |
|
175 | - $L = \ord($lastUchr[2]) - 0x80; |
|
176 | - $V = \ord($uchr[2]) - 0xA1; |
|
177 | - $T = 0; |
|
178 | - |
|
179 | - $uchr = substr($s, $i + $ulen, 3); |
|
180 | - |
|
181 | - if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82") { |
|
182 | - $T = \ord($uchr[2]) - 0xA7; |
|
183 | - 0 > $T && $T += 0x40; |
|
184 | - $ulen += 3; |
|
185 | - } |
|
186 | - |
|
187 | - $L = 0xAC00 + ($L * 21 + $V) * 28 + $T; |
|
188 | - $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F); |
|
189 | - } |
|
190 | - |
|
191 | - $i += $ulen; |
|
192 | - } |
|
193 | - |
|
194 | - return $result.$lastUchr.$tail; |
|
195 | - } |
|
196 | - |
|
197 | - private static function decompose($s, $c) |
|
198 | - { |
|
199 | - $result = ''; |
|
200 | - |
|
201 | - $ASCII = self::$ASCII; |
|
202 | - $decompMap = self::$D; |
|
203 | - $combClass = self::$cC; |
|
204 | - $ulenMask = self::$ulenMask; |
|
205 | - if ($c) { |
|
206 | - $compatMap = self::$KD; |
|
207 | - } |
|
208 | - |
|
209 | - $c = []; |
|
210 | - $i = 0; |
|
211 | - $len = \strlen($s); |
|
212 | - |
|
213 | - while ($i < $len) { |
|
214 | - if ($s[$i] < "\x80") { |
|
215 | - // ASCII chars |
|
216 | - |
|
217 | - if ($c) { |
|
218 | - ksort($c); |
|
219 | - $result .= implode('', $c); |
|
220 | - $c = []; |
|
221 | - } |
|
222 | - |
|
223 | - $j = 1 + strspn($s, $ASCII, $i + 1); |
|
224 | - $result .= substr($s, $i, $j); |
|
225 | - $i += $j; |
|
226 | - continue; |
|
227 | - } |
|
228 | - |
|
229 | - $ulen = $ulenMask[$s[$i] & "\xF0"]; |
|
230 | - $uchr = substr($s, $i, $ulen); |
|
231 | - $i += $ulen; |
|
232 | - |
|
233 | - if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) { |
|
234 | - // Table lookup |
|
235 | - |
|
236 | - if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) { |
|
237 | - $uchr = $j; |
|
238 | - |
|
239 | - $j = \strlen($uchr); |
|
240 | - $ulen = $uchr[0] < "\x80" ? 1 : $ulenMask[$uchr[0] & "\xF0"]; |
|
241 | - |
|
242 | - if ($ulen != $j) { |
|
243 | - // Put trailing chars in $s |
|
244 | - |
|
245 | - $j -= $ulen; |
|
246 | - $i -= $j; |
|
247 | - |
|
248 | - if (0 > $i) { |
|
249 | - $s = str_repeat(' ', -$i).$s; |
|
250 | - $len -= $i; |
|
251 | - $i = 0; |
|
252 | - } |
|
253 | - |
|
254 | - while ($j--) { |
|
255 | - $s[$i + $j] = $uchr[$ulen + $j]; |
|
256 | - } |
|
257 | - |
|
258 | - $uchr = substr($uchr, 0, $ulen); |
|
259 | - } |
|
260 | - } |
|
261 | - if (isset($combClass[$uchr])) { |
|
262 | - // Combining chars, for sorting |
|
263 | - |
|
264 | - if (!isset($c[$combClass[$uchr]])) { |
|
265 | - $c[$combClass[$uchr]] = ''; |
|
266 | - } |
|
267 | - $c[$combClass[$uchr]] .= $uchr; |
|
268 | - continue; |
|
269 | - } |
|
270 | - } else { |
|
271 | - // Hangul chars |
|
272 | - |
|
273 | - $uchr = unpack('C*', $uchr); |
|
274 | - $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80; |
|
275 | - |
|
276 | - $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588)) |
|
277 | - ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28)); |
|
278 | - |
|
279 | - if ($j %= 28) { |
|
280 | - $uchr .= $j < 25 |
|
281 | - ? ("\xE1\x86".\chr(0xA7 + $j)) |
|
282 | - : ("\xE1\x87".\chr(0x67 + $j)); |
|
283 | - } |
|
284 | - } |
|
285 | - if ($c) { |
|
286 | - ksort($c); |
|
287 | - $result .= implode('', $c); |
|
288 | - $c = []; |
|
289 | - } |
|
290 | - |
|
291 | - $result .= $uchr; |
|
292 | - } |
|
293 | - |
|
294 | - if ($c) { |
|
295 | - ksort($c); |
|
296 | - $result .= implode('', $c); |
|
297 | - } |
|
298 | - |
|
299 | - return $result; |
|
300 | - } |
|
301 | - |
|
302 | - private static function getData($file) |
|
303 | - { |
|
304 | - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
|
305 | - return require $file; |
|
306 | - } |
|
307 | - |
|
308 | - return false; |
|
309 | - } |
|
26 | + public const FORM_D = \Normalizer::FORM_D; |
|
27 | + public const FORM_KD = \Normalizer::FORM_KD; |
|
28 | + public const FORM_C = \Normalizer::FORM_C; |
|
29 | + public const FORM_KC = \Normalizer::FORM_KC; |
|
30 | + public const NFD = \Normalizer::NFD; |
|
31 | + public const NFKD = \Normalizer::NFKD; |
|
32 | + public const NFC = \Normalizer::NFC; |
|
33 | + public const NFKC = \Normalizer::NFKC; |
|
34 | + |
|
35 | + private static $C; |
|
36 | + private static $D; |
|
37 | + private static $KD; |
|
38 | + private static $cC; |
|
39 | + private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; |
|
40 | + private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
|
41 | + |
|
42 | + public static function isNormalized(string $s, int $form = self::FORM_C) |
|
43 | + { |
|
44 | + if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) { |
|
45 | + return false; |
|
46 | + } |
|
47 | + if (!isset($s[strspn($s, self::$ASCII)])) { |
|
48 | + return true; |
|
49 | + } |
|
50 | + if (self::NFC == $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) { |
|
51 | + return true; |
|
52 | + } |
|
53 | + |
|
54 | + return self::normalize($s, $form) === $s; |
|
55 | + } |
|
56 | + |
|
57 | + public static function normalize(string $s, int $form = self::FORM_C) |
|
58 | + { |
|
59 | + if (!preg_match('//u', $s)) { |
|
60 | + return false; |
|
61 | + } |
|
62 | + |
|
63 | + switch ($form) { |
|
64 | + case self::NFC: $C = true; $K = false; break; |
|
65 | + case self::NFD: $C = false; $K = false; break; |
|
66 | + case self::NFKC: $C = true; $K = true; break; |
|
67 | + case self::NFKD: $C = false; $K = true; break; |
|
68 | + default: |
|
69 | + if (\defined('Normalizer::NONE') && \Normalizer::NONE == $form) { |
|
70 | + return $s; |
|
71 | + } |
|
72 | + |
|
73 | + if (80000 > \PHP_VERSION_ID) { |
|
74 | + return false; |
|
75 | + } |
|
76 | + |
|
77 | + throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form'); |
|
78 | + } |
|
79 | + |
|
80 | + if ('' === $s) { |
|
81 | + return ''; |
|
82 | + } |
|
83 | + |
|
84 | + if ($K && null === self::$KD) { |
|
85 | + self::$KD = self::getData('compatibilityDecomposition'); |
|
86 | + } |
|
87 | + |
|
88 | + if (null === self::$D) { |
|
89 | + self::$D = self::getData('canonicalDecomposition'); |
|
90 | + self::$cC = self::getData('combiningClass'); |
|
91 | + } |
|
92 | + |
|
93 | + if (null !== $mbEncoding = (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) ? mb_internal_encoding() : null) { |
|
94 | + mb_internal_encoding('8bit'); |
|
95 | + } |
|
96 | + |
|
97 | + $r = self::decompose($s, $K); |
|
98 | + |
|
99 | + if ($C) { |
|
100 | + if (null === self::$C) { |
|
101 | + self::$C = self::getData('canonicalComposition'); |
|
102 | + } |
|
103 | + |
|
104 | + $r = self::recompose($r); |
|
105 | + } |
|
106 | + if (null !== $mbEncoding) { |
|
107 | + mb_internal_encoding($mbEncoding); |
|
108 | + } |
|
109 | + |
|
110 | + return $r; |
|
111 | + } |
|
112 | + |
|
113 | + private static function recompose($s) |
|
114 | + { |
|
115 | + $ASCII = self::$ASCII; |
|
116 | + $compMap = self::$C; |
|
117 | + $combClass = self::$cC; |
|
118 | + $ulenMask = self::$ulenMask; |
|
119 | + |
|
120 | + $result = $tail = ''; |
|
121 | + |
|
122 | + $i = $s[0] < "\x80" ? 1 : $ulenMask[$s[0] & "\xF0"]; |
|
123 | + $len = \strlen($s); |
|
124 | + |
|
125 | + $lastUchr = substr($s, 0, $i); |
|
126 | + $lastUcls = isset($combClass[$lastUchr]) ? 256 : 0; |
|
127 | + |
|
128 | + while ($i < $len) { |
|
129 | + if ($s[$i] < "\x80") { |
|
130 | + // ASCII chars |
|
131 | + |
|
132 | + if ($tail) { |
|
133 | + $lastUchr .= $tail; |
|
134 | + $tail = ''; |
|
135 | + } |
|
136 | + |
|
137 | + if ($j = strspn($s, $ASCII, $i + 1)) { |
|
138 | + $lastUchr .= substr($s, $i, $j); |
|
139 | + $i += $j; |
|
140 | + } |
|
141 | + |
|
142 | + $result .= $lastUchr; |
|
143 | + $lastUchr = $s[$i]; |
|
144 | + $lastUcls = 0; |
|
145 | + ++$i; |
|
146 | + continue; |
|
147 | + } |
|
148 | + |
|
149 | + $ulen = $ulenMask[$s[$i] & "\xF0"]; |
|
150 | + $uchr = substr($s, $i, $ulen); |
|
151 | + |
|
152 | + if ($lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr |
|
153 | + || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr |
|
154 | + || $lastUcls) { |
|
155 | + // Table lookup and combining chars composition |
|
156 | + |
|
157 | + $ucls = $combClass[$uchr] ?? 0; |
|
158 | + |
|
159 | + if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) { |
|
160 | + $lastUchr = $compMap[$lastUchr.$uchr]; |
|
161 | + } elseif ($lastUcls = $ucls) { |
|
162 | + $tail .= $uchr; |
|
163 | + } else { |
|
164 | + if ($tail) { |
|
165 | + $lastUchr .= $tail; |
|
166 | + $tail = ''; |
|
167 | + } |
|
168 | + |
|
169 | + $result .= $lastUchr; |
|
170 | + $lastUchr = $uchr; |
|
171 | + } |
|
172 | + } else { |
|
173 | + // Hangul chars |
|
174 | + |
|
175 | + $L = \ord($lastUchr[2]) - 0x80; |
|
176 | + $V = \ord($uchr[2]) - 0xA1; |
|
177 | + $T = 0; |
|
178 | + |
|
179 | + $uchr = substr($s, $i + $ulen, 3); |
|
180 | + |
|
181 | + if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82") { |
|
182 | + $T = \ord($uchr[2]) - 0xA7; |
|
183 | + 0 > $T && $T += 0x40; |
|
184 | + $ulen += 3; |
|
185 | + } |
|
186 | + |
|
187 | + $L = 0xAC00 + ($L * 21 + $V) * 28 + $T; |
|
188 | + $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F); |
|
189 | + } |
|
190 | + |
|
191 | + $i += $ulen; |
|
192 | + } |
|
193 | + |
|
194 | + return $result.$lastUchr.$tail; |
|
195 | + } |
|
196 | + |
|
197 | + private static function decompose($s, $c) |
|
198 | + { |
|
199 | + $result = ''; |
|
200 | + |
|
201 | + $ASCII = self::$ASCII; |
|
202 | + $decompMap = self::$D; |
|
203 | + $combClass = self::$cC; |
|
204 | + $ulenMask = self::$ulenMask; |
|
205 | + if ($c) { |
|
206 | + $compatMap = self::$KD; |
|
207 | + } |
|
208 | + |
|
209 | + $c = []; |
|
210 | + $i = 0; |
|
211 | + $len = \strlen($s); |
|
212 | + |
|
213 | + while ($i < $len) { |
|
214 | + if ($s[$i] < "\x80") { |
|
215 | + // ASCII chars |
|
216 | + |
|
217 | + if ($c) { |
|
218 | + ksort($c); |
|
219 | + $result .= implode('', $c); |
|
220 | + $c = []; |
|
221 | + } |
|
222 | + |
|
223 | + $j = 1 + strspn($s, $ASCII, $i + 1); |
|
224 | + $result .= substr($s, $i, $j); |
|
225 | + $i += $j; |
|
226 | + continue; |
|
227 | + } |
|
228 | + |
|
229 | + $ulen = $ulenMask[$s[$i] & "\xF0"]; |
|
230 | + $uchr = substr($s, $i, $ulen); |
|
231 | + $i += $ulen; |
|
232 | + |
|
233 | + if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) { |
|
234 | + // Table lookup |
|
235 | + |
|
236 | + if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) { |
|
237 | + $uchr = $j; |
|
238 | + |
|
239 | + $j = \strlen($uchr); |
|
240 | + $ulen = $uchr[0] < "\x80" ? 1 : $ulenMask[$uchr[0] & "\xF0"]; |
|
241 | + |
|
242 | + if ($ulen != $j) { |
|
243 | + // Put trailing chars in $s |
|
244 | + |
|
245 | + $j -= $ulen; |
|
246 | + $i -= $j; |
|
247 | + |
|
248 | + if (0 > $i) { |
|
249 | + $s = str_repeat(' ', -$i).$s; |
|
250 | + $len -= $i; |
|
251 | + $i = 0; |
|
252 | + } |
|
253 | + |
|
254 | + while ($j--) { |
|
255 | + $s[$i + $j] = $uchr[$ulen + $j]; |
|
256 | + } |
|
257 | + |
|
258 | + $uchr = substr($uchr, 0, $ulen); |
|
259 | + } |
|
260 | + } |
|
261 | + if (isset($combClass[$uchr])) { |
|
262 | + // Combining chars, for sorting |
|
263 | + |
|
264 | + if (!isset($c[$combClass[$uchr]])) { |
|
265 | + $c[$combClass[$uchr]] = ''; |
|
266 | + } |
|
267 | + $c[$combClass[$uchr]] .= $uchr; |
|
268 | + continue; |
|
269 | + } |
|
270 | + } else { |
|
271 | + // Hangul chars |
|
272 | + |
|
273 | + $uchr = unpack('C*', $uchr); |
|
274 | + $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80; |
|
275 | + |
|
276 | + $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588)) |
|
277 | + ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28)); |
|
278 | + |
|
279 | + if ($j %= 28) { |
|
280 | + $uchr .= $j < 25 |
|
281 | + ? ("\xE1\x86".\chr(0xA7 + $j)) |
|
282 | + : ("\xE1\x87".\chr(0x67 + $j)); |
|
283 | + } |
|
284 | + } |
|
285 | + if ($c) { |
|
286 | + ksort($c); |
|
287 | + $result .= implode('', $c); |
|
288 | + $c = []; |
|
289 | + } |
|
290 | + |
|
291 | + $result .= $uchr; |
|
292 | + } |
|
293 | + |
|
294 | + if ($c) { |
|
295 | + ksort($c); |
|
296 | + $result .= implode('', $c); |
|
297 | + } |
|
298 | + |
|
299 | + return $result; |
|
300 | + } |
|
301 | + |
|
302 | + private static function getData($file) |
|
303 | + { |
|
304 | + if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
|
305 | + return require $file; |
|
306 | + } |
|
307 | + |
|
308 | + return false; |
|
309 | + } |
|
310 | 310 | } |
@@ -36,81 +36,81 @@ discard block |
||
36 | 36 | private static $D; |
37 | 37 | private static $KD; |
38 | 38 | private static $cC; |
39 | - private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; |
|
39 | + private static $ulenMask = [ "\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4 ]; |
|
40 | 40 | private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
41 | 41 | |
42 | - public static function isNormalized(string $s, int $form = self::FORM_C) |
|
42 | + public static function isNormalized( string $s, int $form = self::FORM_C ) |
|
43 | 43 | { |
44 | - if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) { |
|
44 | + if ( ! \in_array( $form, [ self::NFD, self::NFKD, self::NFC, self::NFKC ] ) ) { |
|
45 | 45 | return false; |
46 | 46 | } |
47 | - if (!isset($s[strspn($s, self::$ASCII)])) { |
|
47 | + if ( ! isset( $s[ strspn( $s, self::$ASCII ) ] ) ) { |
|
48 | 48 | return true; |
49 | 49 | } |
50 | - if (self::NFC == $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) { |
|
50 | + if ( self::NFC == $form && preg_match( '//u', $s ) && ! preg_match( '/[^\x00-\x{2FF}]/u', $s ) ) { |
|
51 | 51 | return true; |
52 | 52 | } |
53 | 53 | |
54 | - return self::normalize($s, $form) === $s; |
|
54 | + return self::normalize( $s, $form ) === $s; |
|
55 | 55 | } |
56 | 56 | |
57 | - public static function normalize(string $s, int $form = self::FORM_C) |
|
57 | + public static function normalize( string $s, int $form = self::FORM_C ) |
|
58 | 58 | { |
59 | - if (!preg_match('//u', $s)) { |
|
59 | + if ( ! preg_match( '//u', $s ) ) { |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
63 | - switch ($form) { |
|
63 | + switch ( $form ) { |
|
64 | 64 | case self::NFC: $C = true; $K = false; break; |
65 | 65 | case self::NFD: $C = false; $K = false; break; |
66 | 66 | case self::NFKC: $C = true; $K = true; break; |
67 | 67 | case self::NFKD: $C = false; $K = true; break; |
68 | 68 | default: |
69 | - if (\defined('Normalizer::NONE') && \Normalizer::NONE == $form) { |
|
69 | + if ( \defined( 'Normalizer::NONE' ) && \Normalizer::NONE == $form ) { |
|
70 | 70 | return $s; |
71 | 71 | } |
72 | 72 | |
73 | - if (80000 > \PHP_VERSION_ID) { |
|
73 | + if ( 80000 > \PHP_VERSION_ID ) { |
|
74 | 74 | return false; |
75 | 75 | } |
76 | 76 | |
77 | - throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form'); |
|
77 | + throw new \ValueError( 'normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form' ); |
|
78 | 78 | } |
79 | 79 | |
80 | - if ('' === $s) { |
|
80 | + if ( '' === $s ) { |
|
81 | 81 | return ''; |
82 | 82 | } |
83 | 83 | |
84 | - if ($K && null === self::$KD) { |
|
85 | - self::$KD = self::getData('compatibilityDecomposition'); |
|
84 | + if ( $K && null === self::$KD ) { |
|
85 | + self::$KD = self::getData( 'compatibilityDecomposition' ); |
|
86 | 86 | } |
87 | 87 | |
88 | - if (null === self::$D) { |
|
89 | - self::$D = self::getData('canonicalDecomposition'); |
|
90 | - self::$cC = self::getData('combiningClass'); |
|
88 | + if ( null === self::$D ) { |
|
89 | + self::$D = self::getData( 'canonicalDecomposition' ); |
|
90 | + self::$cC = self::getData( 'combiningClass' ); |
|
91 | 91 | } |
92 | 92 | |
93 | - if (null !== $mbEncoding = (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) ? mb_internal_encoding() : null) { |
|
94 | - mb_internal_encoding('8bit'); |
|
93 | + if ( null !== $mbEncoding = ( 2 /* MB_OVERLOAD_STRING */ & (int)ini_get( 'mbstring.func_overload' ) ) ? mb_internal_encoding() : null ) { |
|
94 | + mb_internal_encoding( '8bit' ); |
|
95 | 95 | } |
96 | 96 | |
97 | - $r = self::decompose($s, $K); |
|
97 | + $r = self::decompose( $s, $K ); |
|
98 | 98 | |
99 | - if ($C) { |
|
100 | - if (null === self::$C) { |
|
101 | - self::$C = self::getData('canonicalComposition'); |
|
99 | + if ( $C ) { |
|
100 | + if ( null === self::$C ) { |
|
101 | + self::$C = self::getData( 'canonicalComposition' ); |
|
102 | 102 | } |
103 | 103 | |
104 | - $r = self::recompose($r); |
|
104 | + $r = self::recompose( $r ); |
|
105 | 105 | } |
106 | - if (null !== $mbEncoding) { |
|
107 | - mb_internal_encoding($mbEncoding); |
|
106 | + if ( null !== $mbEncoding ) { |
|
107 | + mb_internal_encoding( $mbEncoding ); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $r; |
111 | 111 | } |
112 | 112 | |
113 | - private static function recompose($s) |
|
113 | + private static function recompose( $s ) |
|
114 | 114 | { |
115 | 115 | $ASCII = self::$ASCII; |
116 | 116 | $compMap = self::$C; |
@@ -119,49 +119,49 @@ discard block |
||
119 | 119 | |
120 | 120 | $result = $tail = ''; |
121 | 121 | |
122 | - $i = $s[0] < "\x80" ? 1 : $ulenMask[$s[0] & "\xF0"]; |
|
123 | - $len = \strlen($s); |
|
122 | + $i = $s[ 0 ] < "\x80" ? 1 : $ulenMask[ $s[ 0 ] & "\xF0" ]; |
|
123 | + $len = \strlen( $s ); |
|
124 | 124 | |
125 | - $lastUchr = substr($s, 0, $i); |
|
126 | - $lastUcls = isset($combClass[$lastUchr]) ? 256 : 0; |
|
125 | + $lastUchr = substr( $s, 0, $i ); |
|
126 | + $lastUcls = isset( $combClass[ $lastUchr ] ) ? 256 : 0; |
|
127 | 127 | |
128 | - while ($i < $len) { |
|
129 | - if ($s[$i] < "\x80") { |
|
128 | + while ( $i < $len ) { |
|
129 | + if ( $s[ $i ] < "\x80" ) { |
|
130 | 130 | // ASCII chars |
131 | 131 | |
132 | - if ($tail) { |
|
132 | + if ( $tail ) { |
|
133 | 133 | $lastUchr .= $tail; |
134 | 134 | $tail = ''; |
135 | 135 | } |
136 | 136 | |
137 | - if ($j = strspn($s, $ASCII, $i + 1)) { |
|
138 | - $lastUchr .= substr($s, $i, $j); |
|
137 | + if ( $j = strspn( $s, $ASCII, $i + 1 ) ) { |
|
138 | + $lastUchr .= substr( $s, $i, $j ); |
|
139 | 139 | $i += $j; |
140 | 140 | } |
141 | 141 | |
142 | 142 | $result .= $lastUchr; |
143 | - $lastUchr = $s[$i]; |
|
143 | + $lastUchr = $s[ $i ]; |
|
144 | 144 | $lastUcls = 0; |
145 | 145 | ++$i; |
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
149 | - $ulen = $ulenMask[$s[$i] & "\xF0"]; |
|
150 | - $uchr = substr($s, $i, $ulen); |
|
149 | + $ulen = $ulenMask[ $s[ $i ] & "\xF0" ]; |
|
150 | + $uchr = substr( $s, $i, $ulen ); |
|
151 | 151 | |
152 | - if ($lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr |
|
152 | + if ( $lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr |
|
153 | 153 | || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr |
154 | - || $lastUcls) { |
|
154 | + || $lastUcls ) { |
|
155 | 155 | // Table lookup and combining chars composition |
156 | 156 | |
157 | - $ucls = $combClass[$uchr] ?? 0; |
|
157 | + $ucls = $combClass[ $uchr ] ?? 0; |
|
158 | 158 | |
159 | - if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) { |
|
160 | - $lastUchr = $compMap[$lastUchr.$uchr]; |
|
161 | - } elseif ($lastUcls = $ucls) { |
|
159 | + if ( isset( $compMap[ $lastUchr . $uchr ] ) && ( ! $lastUcls || $lastUcls < $ucls ) ) { |
|
160 | + $lastUchr = $compMap[ $lastUchr . $uchr ]; |
|
161 | + } elseif ( $lastUcls = $ucls ) { |
|
162 | 162 | $tail .= $uchr; |
163 | 163 | } else { |
164 | - if ($tail) { |
|
164 | + if ( $tail ) { |
|
165 | 165 | $lastUchr .= $tail; |
166 | 166 | $tail = ''; |
167 | 167 | } |
@@ -172,29 +172,29 @@ discard block |
||
172 | 172 | } else { |
173 | 173 | // Hangul chars |
174 | 174 | |
175 | - $L = \ord($lastUchr[2]) - 0x80; |
|
176 | - $V = \ord($uchr[2]) - 0xA1; |
|
175 | + $L = \ord( $lastUchr[ 2 ] ) - 0x80; |
|
176 | + $V = \ord( $uchr[ 2 ] ) - 0xA1; |
|
177 | 177 | $T = 0; |
178 | 178 | |
179 | - $uchr = substr($s, $i + $ulen, 3); |
|
179 | + $uchr = substr( $s, $i + $ulen, 3 ); |
|
180 | 180 | |
181 | - if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82") { |
|
182 | - $T = \ord($uchr[2]) - 0xA7; |
|
181 | + if ( "\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82" ) { |
|
182 | + $T = \ord( $uchr[ 2 ] ) - 0xA7; |
|
183 | 183 | 0 > $T && $T += 0x40; |
184 | 184 | $ulen += 3; |
185 | 185 | } |
186 | 186 | |
187 | - $L = 0xAC00 + ($L * 21 + $V) * 28 + $T; |
|
188 | - $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F); |
|
187 | + $L = 0xAC00 + ( $L * 21 + $V ) * 28 + $T; |
|
188 | + $lastUchr = \chr( 0xE0 | $L >> 12 ) . \chr( 0x80 | $L >> 6 & 0x3F ) . \chr( 0x80 | $L & 0x3F ); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $i += $ulen; |
192 | 192 | } |
193 | 193 | |
194 | - return $result.$lastUchr.$tail; |
|
194 | + return $result . $lastUchr . $tail; |
|
195 | 195 | } |
196 | 196 | |
197 | - private static function decompose($s, $c) |
|
197 | + private static function decompose( $s, $c ) |
|
198 | 198 | { |
199 | 199 | $result = ''; |
200 | 200 | |
@@ -202,106 +202,106 @@ discard block |
||
202 | 202 | $decompMap = self::$D; |
203 | 203 | $combClass = self::$cC; |
204 | 204 | $ulenMask = self::$ulenMask; |
205 | - if ($c) { |
|
205 | + if ( $c ) { |
|
206 | 206 | $compatMap = self::$KD; |
207 | 207 | } |
208 | 208 | |
209 | - $c = []; |
|
209 | + $c = [ ]; |
|
210 | 210 | $i = 0; |
211 | - $len = \strlen($s); |
|
211 | + $len = \strlen( $s ); |
|
212 | 212 | |
213 | - while ($i < $len) { |
|
214 | - if ($s[$i] < "\x80") { |
|
213 | + while ( $i < $len ) { |
|
214 | + if ( $s[ $i ] < "\x80" ) { |
|
215 | 215 | // ASCII chars |
216 | 216 | |
217 | - if ($c) { |
|
218 | - ksort($c); |
|
219 | - $result .= implode('', $c); |
|
220 | - $c = []; |
|
217 | + if ( $c ) { |
|
218 | + ksort( $c ); |
|
219 | + $result .= implode( '', $c ); |
|
220 | + $c = [ ]; |
|
221 | 221 | } |
222 | 222 | |
223 | - $j = 1 + strspn($s, $ASCII, $i + 1); |
|
224 | - $result .= substr($s, $i, $j); |
|
223 | + $j = 1 + strspn( $s, $ASCII, $i + 1 ); |
|
224 | + $result .= substr( $s, $i, $j ); |
|
225 | 225 | $i += $j; |
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
229 | - $ulen = $ulenMask[$s[$i] & "\xF0"]; |
|
230 | - $uchr = substr($s, $i, $ulen); |
|
229 | + $ulen = $ulenMask[ $s[ $i ] & "\xF0" ]; |
|
230 | + $uchr = substr( $s, $i, $ulen ); |
|
231 | 231 | $i += $ulen; |
232 | 232 | |
233 | - if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) { |
|
233 | + if ( $uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr ) { |
|
234 | 234 | // Table lookup |
235 | 235 | |
236 | - if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) { |
|
236 | + if ( $uchr !== $j = $compatMap[ $uchr ] ?? ( $decompMap[ $uchr ] ?? $uchr ) ) { |
|
237 | 237 | $uchr = $j; |
238 | 238 | |
239 | - $j = \strlen($uchr); |
|
240 | - $ulen = $uchr[0] < "\x80" ? 1 : $ulenMask[$uchr[0] & "\xF0"]; |
|
239 | + $j = \strlen( $uchr ); |
|
240 | + $ulen = $uchr[ 0 ] < "\x80" ? 1 : $ulenMask[ $uchr[ 0 ] & "\xF0" ]; |
|
241 | 241 | |
242 | - if ($ulen != $j) { |
|
242 | + if ( $ulen != $j ) { |
|
243 | 243 | // Put trailing chars in $s |
244 | 244 | |
245 | 245 | $j -= $ulen; |
246 | 246 | $i -= $j; |
247 | 247 | |
248 | - if (0 > $i) { |
|
249 | - $s = str_repeat(' ', -$i).$s; |
|
248 | + if ( 0 > $i ) { |
|
249 | + $s = str_repeat( ' ', -$i ) . $s; |
|
250 | 250 | $len -= $i; |
251 | 251 | $i = 0; |
252 | 252 | } |
253 | 253 | |
254 | - while ($j--) { |
|
255 | - $s[$i + $j] = $uchr[$ulen + $j]; |
|
254 | + while ( $j-- ) { |
|
255 | + $s[ $i + $j ] = $uchr[ $ulen + $j ]; |
|
256 | 256 | } |
257 | 257 | |
258 | - $uchr = substr($uchr, 0, $ulen); |
|
258 | + $uchr = substr( $uchr, 0, $ulen ); |
|
259 | 259 | } |
260 | 260 | } |
261 | - if (isset($combClass[$uchr])) { |
|
261 | + if ( isset( $combClass[ $uchr ] ) ) { |
|
262 | 262 | // Combining chars, for sorting |
263 | 263 | |
264 | - if (!isset($c[$combClass[$uchr]])) { |
|
265 | - $c[$combClass[$uchr]] = ''; |
|
264 | + if ( ! isset( $c[ $combClass[ $uchr ] ] ) ) { |
|
265 | + $c[ $combClass[ $uchr ] ] = ''; |
|
266 | 266 | } |
267 | - $c[$combClass[$uchr]] .= $uchr; |
|
267 | + $c[ $combClass[ $uchr ] ] .= $uchr; |
|
268 | 268 | continue; |
269 | 269 | } |
270 | 270 | } else { |
271 | 271 | // Hangul chars |
272 | 272 | |
273 | - $uchr = unpack('C*', $uchr); |
|
274 | - $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80; |
|
273 | + $uchr = unpack( 'C*', $uchr ); |
|
274 | + $j = ( ( $uchr[ 1 ] - 224 ) << 12 ) + ( ( $uchr[ 2 ] - 128 ) << 6 ) + $uchr[ 3 ] - 0xAC80; |
|
275 | 275 | |
276 | - $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588)) |
|
277 | - ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28)); |
|
276 | + $uchr = "\xE1\x84" . \chr( 0x80 + (int)( $j / 588 ) ) |
|
277 | + ."\xE1\x85" . \chr( 0xA1 + (int)( ( $j % 588 ) / 28 ) ); |
|
278 | 278 | |
279 | - if ($j %= 28) { |
|
279 | + if ( $j %= 28 ) { |
|
280 | 280 | $uchr .= $j < 25 |
281 | - ? ("\xE1\x86".\chr(0xA7 + $j)) |
|
282 | - : ("\xE1\x87".\chr(0x67 + $j)); |
|
281 | + ? ( "\xE1\x86" . \chr( 0xA7 + $j ) ) |
|
282 | + : ( "\xE1\x87" . \chr( 0x67 + $j ) ); |
|
283 | 283 | } |
284 | 284 | } |
285 | - if ($c) { |
|
286 | - ksort($c); |
|
287 | - $result .= implode('', $c); |
|
288 | - $c = []; |
|
285 | + if ( $c ) { |
|
286 | + ksort( $c ); |
|
287 | + $result .= implode( '', $c ); |
|
288 | + $c = [ ]; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | $result .= $uchr; |
292 | 292 | } |
293 | 293 | |
294 | - if ($c) { |
|
295 | - ksort($c); |
|
296 | - $result .= implode('', $c); |
|
294 | + if ( $c ) { |
|
295 | + ksort( $c ); |
|
296 | + $result .= implode( '', $c ); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | return $result; |
300 | 300 | } |
301 | 301 | |
302 | - private static function getData($file) |
|
302 | + private static function getData( $file ) |
|
303 | 303 | { |
304 | - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
|
304 | + if ( file_exists( $file = __DIR__ . '/Resources/unidata/' . $file . '.php' ) ) { |
|
305 | 305 | return require $file; |
306 | 306 | } |
307 | 307 |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @internal |
23 | 23 | */ |
24 | -class Normalizer |
|
25 | -{ |
|
24 | +class Normalizer { |
|
26 | 25 | public const FORM_D = \Normalizer::FORM_D; |
27 | 26 | public const FORM_KD = \Normalizer::FORM_KD; |
28 | 27 | public const FORM_C = \Normalizer::FORM_C; |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; |
40 | 39 | private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
41 | 40 | |
42 | - public static function isNormalized(string $s, int $form = self::FORM_C) |
|
43 | - { |
|
41 | + public static function isNormalized(string $s, int $form = self::FORM_C) { |
|
44 | 42 | if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) { |
45 | 43 | return false; |
46 | 44 | } |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | return self::normalize($s, $form) === $s; |
55 | 53 | } |
56 | 54 | |
57 | - public static function normalize(string $s, int $form = self::FORM_C) |
|
58 | - { |
|
55 | + public static function normalize(string $s, int $form = self::FORM_C) { |
|
59 | 56 | if (!preg_match('//u', $s)) { |
60 | 57 | return false; |
61 | 58 | } |
@@ -110,8 +107,7 @@ discard block |
||
110 | 107 | return $r; |
111 | 108 | } |
112 | 109 | |
113 | - private static function recompose($s) |
|
114 | - { |
|
110 | + private static function recompose($s) { |
|
115 | 111 | $ASCII = self::$ASCII; |
116 | 112 | $compMap = self::$C; |
117 | 113 | $combClass = self::$cC; |
@@ -194,8 +190,7 @@ discard block |
||
194 | 190 | return $result.$lastUchr.$tail; |
195 | 191 | } |
196 | 192 | |
197 | - private static function decompose($s, $c) |
|
198 | - { |
|
193 | + private static function decompose($s, $c) { |
|
199 | 194 | $result = ''; |
200 | 195 | |
201 | 196 | $ASCII = self::$ASCII; |
@@ -299,8 +294,7 @@ discard block |
||
299 | 294 | return $result; |
300 | 295 | } |
301 | 296 | |
302 | - private static function getData($file) |
|
303 | - { |
|
297 | + private static function getData($file) { |
|
304 | 298 | if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
305 | 299 | return require $file; |
306 | 300 | } |
@@ -12,8 +12,8 @@ |
||
12 | 12 | use Symfony\Polyfill\Intl\Normalizer as p; |
13 | 13 | |
14 | 14 | if (!function_exists('normalizer_is_normalized')) { |
15 | - function normalizer_is_normalized(?string $string, ?int $form = p\Normalizer::FORM_C): bool { return p\Normalizer::isNormalized((string) $string, (int) $form); } |
|
15 | + function normalizer_is_normalized(?string $string, ?int $form = p\Normalizer::FORM_C): bool { return p\Normalizer::isNormalized((string) $string, (int) $form); } |
|
16 | 16 | } |
17 | 17 | if (!function_exists('normalizer_normalize')) { |
18 | - function normalizer_normalize(?string $string, ?int $form = p\Normalizer::FORM_C): string|false { return p\Normalizer::normalize((string) $string, (int) $form); } |
|
18 | + function normalizer_normalize(?string $string, ?int $form = p\Normalizer::FORM_C): string|false { return p\Normalizer::normalize((string) $string, (int) $form); } |
|
19 | 19 | } |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | use Symfony\Polyfill\Intl\Normalizer as p; |
13 | 13 | |
14 | -if (!function_exists('normalizer_is_normalized')) { |
|
15 | - function normalizer_is_normalized(?string $string, ?int $form = p\Normalizer::FORM_C): bool { return p\Normalizer::isNormalized((string) $string, (int) $form); } |
|
14 | +if ( ! function_exists( 'normalizer_is_normalized' ) ) { |
|
15 | + function normalizer_is_normalized( ?string $string, ?int $form = p\Normalizer::FORM_C ): bool { return p\Normalizer::isNormalized( (string)$string, (int)$form ); } |
|
16 | 16 | } |
17 | -if (!function_exists('normalizer_normalize')) { |
|
18 | - function normalizer_normalize(?string $string, ?int $form = p\Normalizer::FORM_C): string|false { return p\Normalizer::normalize((string) $string, (int) $form); } |
|
17 | +if ( ! function_exists( 'normalizer_normalize' ) ) { |
|
18 | + function normalizer_normalize( ?string $string, ?int $form = p\Normalizer::FORM_C ): string | false { return p\Normalizer::normalize( (string)$string, (int)$form ); } |
|
19 | 19 | } |
@@ -2,16 +2,16 @@ |
||
2 | 2 | |
3 | 3 | class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer |
4 | 4 | { |
5 | - /** |
|
6 | - * @deprecated since ICU 56 and removed in PHP 8 |
|
7 | - */ |
|
8 | - public const NONE = 2; |
|
9 | - public const FORM_D = 4; |
|
10 | - public const FORM_KD = 8; |
|
11 | - public const FORM_C = 16; |
|
12 | - public const FORM_KC = 32; |
|
13 | - public const NFD = 4; |
|
14 | - public const NFKD = 8; |
|
15 | - public const NFC = 16; |
|
16 | - public const NFKC = 32; |
|
5 | + /** |
|
6 | + * @deprecated since ICU 56 and removed in PHP 8 |
|
7 | + */ |
|
8 | + public const NONE = 2; |
|
9 | + public const FORM_D = 4; |
|
10 | + public const FORM_KD = 8; |
|
11 | + public const FORM_C = 16; |
|
12 | + public const FORM_KC = 32; |
|
13 | + public const NFD = 4; |
|
14 | + public const NFKD = 8; |
|
15 | + public const NFC = 16; |
|
16 | + public const NFKC = 32; |
|
17 | 17 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer |
|
4 | -{ |
|
3 | +class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer { |
|
5 | 4 | /** |
6 | 5 | * @deprecated since ICU 56 and removed in PHP 8 |
7 | 6 | */ |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | 'À' => 'À', |
5 | 5 | 'Á' => 'Á', |
6 | 6 | 'Â' => 'Â', |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | ' ' => ' ', |
5 | 5 | '¨' => ' ̈', |
6 | 6 | 'ª' => 'a', |