|
9 | 9 | final class CharacterSetECI |
10 | 10 | { |
11 | 11 | /**#@+ |
12 | | - * Character set constants. |
| 12 | + * Character set constants. |
| 13 | + */ |
| 14 | + /** |
| 15 | + * @var int |
13 | 16 | */ |
14 | 17 | public const CP437 = 0; |
| 18 | + /** |
| 19 | + * @var int |
| 20 | + */ |
15 | 21 | public const ISO8859_1 = 1; |
| 22 | + /** |
| 23 | + * @var int |
| 24 | + */ |
16 | 25 | public const ISO8859_2 = 4; |
| 26 | + /** |
| 27 | + * @var int |
| 28 | + */ |
17 | 29 | public const ISO8859_3 = 5; |
| 30 | + /** |
| 31 | + * @var int |
| 32 | + */ |
18 | 33 | public const ISO8859_4 = 6; |
| 34 | + /** |
| 35 | + * @var int |
| 36 | + */ |
19 | 37 | public const ISO8859_5 = 7; |
| 38 | + /** |
| 39 | + * @var int |
| 40 | + */ |
20 | 41 | public const ISO8859_6 = 8; |
| 42 | + /** |
| 43 | + * @var int |
| 44 | + */ |
21 | 45 | public const ISO8859_7 = 9; |
| 46 | + /** |
| 47 | + * @var int |
| 48 | + */ |
22 | 49 | public const ISO8859_8 = 10; |
| 50 | + /** |
| 51 | + * @var int |
| 52 | + */ |
23 | 53 | public const ISO8859_9 = 11; |
| 54 | + /** |
| 55 | + * @var int |
| 56 | + */ |
24 | 57 | public const ISO8859_10 = 12; |
| 58 | + /** |
| 59 | + * @var int |
| 60 | + */ |
25 | 61 | public const ISO8859_11 = 13; |
| 62 | + /** |
| 63 | + * @var int |
| 64 | + */ |
26 | 65 | public const ISO8859_12 = 14; |
| 66 | + /** |
| 67 | + * @var int |
| 68 | + */ |
27 | 69 | public const ISO8859_13 = 15; |
| 70 | + /** |
| 71 | + * @var int |
| 72 | + */ |
28 | 73 | public const ISO8859_14 = 16; |
| 74 | + /** |
| 75 | + * @var int |
| 76 | + */ |
29 | 77 | public const ISO8859_15 = 17; |
| 78 | + /** |
| 79 | + * @var int |
| 80 | + */ |
30 | 81 | public const ISO8859_16 = 18; |
| 82 | + /** |
| 83 | + * @var int |
| 84 | + */ |
31 | 85 | public const SJIS = 20; |
| 86 | + /** |
| 87 | + * @var int |
| 88 | + */ |
32 | 89 | public const CP1250 = 21; |
| 90 | + /** |
| 91 | + * @var int |
| 92 | + */ |
33 | 93 | public const CP1251 = 22; |
| 94 | + /** |
| 95 | + * @var int |
| 96 | + */ |
34 | 97 | public const CP1252 = 23; |
| 98 | + /** |
| 99 | + * @var int |
| 100 | + */ |
35 | 101 | public const CP1256 = 24; |
| 102 | + /** |
| 103 | + * @var int |
| 104 | + */ |
36 | 105 | public const UNICODE_BIG_UNMARKED = 25; |
| 106 | + /** |
| 107 | + * @var int |
| 108 | + */ |
37 | 109 | public const UTF8 = 26; |
| 110 | + /** |
| 111 | + * @var int |
| 112 | + */ |
38 | 113 | public const ASCII = 27; |
| 114 | + /** |
| 115 | + * @var int |
| 116 | + */ |
39 | 117 | public const BIG5 = 28; |
| 118 | + /** |
| 119 | + * @var int |
| 120 | + */ |
40 | 121 | public const GB18030 = 29; |
| 122 | + /** |
| 123 | + * @var int |
| 124 | + */ |
41 | 125 | public const EUC_KR = 30; |
42 | 126 | /** |
43 | 127 | * Map between character names and their ECI values. |
44 | 128 | */ |
45 | | - private static array $nameToEci = [ |
| 129 | + private static array $nameToEci = [ |
46 | 130 | 'ISO-8859-1' => self::ISO8859_1, |
47 | 131 | 'ISO-8859-2' => self::ISO8859_2, |
48 | 132 | 'ISO-8859-3' => self::ISO8859_3, |
@@ -71,23 +155,22 @@ final class CharacterSetECI |
71 | 155 | 'EUC-KR' => self::EUC_KR, |
72 | 156 | ]; |
73 | 157 | /**#@-*/ |
74 | | - /** |
75 | | - * Additional possible values for character sets. |
76 | | - */ |
77 | | - private static array $additionalValues = [ |
| 158 | + /** |
| 159 | + * Additional possible values for character sets. |
| 160 | + */ |
| 161 | + private static array $additionalValues = [ |
78 | 162 | self::CP437 => 2, |
79 | 163 | self::ASCII => 170, |
80 | 164 | ]; |
81 | 165 | private static int|string|null $name = null; |
82 | 166 |
|
83 | 167 | /** |
84 | | - * Gets character set ECI by value. |
85 | | - * |
86 | | - * @param string $value |
87 | | - * |
88 | | - * @return CharacterSetEci|null |
89 | | - */ |
90 | | - public static function getCharacterSetECIByValue($value) |
| 168 | + * Gets character set ECI by value. |
| 169 | + * |
| 170 | + * |
| 171 | + * @return CharacterSetEci|null |
| 172 | + */ |
| 173 | + public static function getCharacterSetECIByValue(string $value) |
91 | 174 | { |
92 | 175 | if ($value < 0 || $value >= 900) { |
93 | 176 | throw new \InvalidArgumentException('Value must be between 0 and 900'); |
@@ -136,13 +219,12 @@ public static function name() |
136 | 219 | } |
137 | 220 |
|
138 | 221 | /** |
139 | | - * Gets character set ECI by name. |
140 | | - * |
141 | | - * @param string $name |
142 | | - * |
143 | | - * @return CharacterSetEci|null |
144 | | - */ |
145 | | - public static function getCharacterSetECIByName($name) |
| 222 | + * Gets character set ECI by name. |
| 223 | + * |
| 224 | + * |
| 225 | + * @return CharacterSetEci|null |
| 226 | + */ |
| 227 | + public static function getCharacterSetECIByName(string $name) |
146 | 228 | { |
147 | 229 | $name = strtoupper($name); |
148 | 230 | if (isset(self::$nameToEci[$name])) { |
|
0 commit comments