1 | <?php |
||
15 | abstract class Converter |
||
16 | { |
||
17 | const UTF8 = 'UTF-8'; |
||
18 | const UTF16BE = 'UTF-16BE'; |
||
19 | const UTF16LE = 'UTF-16LE'; |
||
20 | const UTF32BE = 'UTF-32BE'; |
||
21 | const UTF32LE = 'UTF-32LE'; |
||
22 | |||
23 | /** |
||
24 | * @param string $string |
||
25 | * @param string $fromEncoding |
||
26 | * @param string $toEncoding |
||
27 | * |
||
28 | * @return string |
||
29 | * @throws \Crossjoin\Json\Exception\InvalidArgumentException |
||
30 | * @throws \Crossjoin\Json\Exception\ConversionFailedException |
||
31 | * @throws \Crossjoin\Json\Exception\ExtensionRequiredException |
||
32 | */ |
||
33 | public function convertEncoding($string, $fromEncoding, $toEncoding) |
||
50 | |||
51 | /** |
||
52 | * @param $string |
||
53 | * @param $fromEncoding |
||
54 | * @param $toEncoding |
||
55 | * |
||
56 | * @return string |
||
57 | * @throws \Crossjoin\Json\Exception\ExtensionRequiredException |
||
58 | * @throws \Crossjoin\Json\Exception\ConversionFailedException |
||
59 | */ |
||
60 | private function tryConvertEncoding($string, $fromEncoding, $toEncoding) |
||
77 | |||
78 | /** |
||
79 | * Removes the byte order mark (BOM) from the JSON text. This is not allowed in JSON, |
||
80 | * but may be ignored when parsing it. |
||
81 | * |
||
82 | * @param string $string |
||
83 | * |
||
84 | * @return string |
||
85 | * @throws \Crossjoin\Json\Exception\InvalidArgumentException |
||
86 | */ |
||
87 | public function removeByteOrderMark($string) |
||
106 | |||
107 | /** |
||
108 | * @return NativeJsonErrorException |
||
109 | */ |
||
110 | protected function getNativeJsonErrorException() |
||
118 | |||
119 | /** |
||
120 | * @param $string |
||
121 | * @param $fromEncoding |
||
122 | * @param $toEncoding |
||
123 | * |
||
124 | * @return string|null |
||
125 | * @throws \Crossjoin\Json\Exception\ConversionFailedException |
||
126 | */ |
||
127 | private function convertWithIconv($string, $fromEncoding, $toEncoding) |
||
140 | |||
141 | /** |
||
142 | * @param $string |
||
143 | * @param $fromEncoding |
||
144 | * @param $toEncoding |
||
145 | * |
||
146 | * @return string|null |
||
147 | */ |
||
148 | private function convertWithUConverter($string, $fromEncoding, $toEncoding) |
||
160 | |||
161 | /** |
||
162 | * @param $string |
||
163 | * @param $fromEncoding |
||
164 | * @param $toEncoding |
||
165 | * |
||
166 | * @return string|null |
||
167 | */ |
||
168 | private function convertWithMultiByteString($string, $fromEncoding, $toEncoding) |
||
177 | } |
||
178 |