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) |
||
60 | |||
61 | /** |
||
62 | * Removes the byte order mark (BOM) from the JSON text. This is not allowed in JSON, |
||
63 | * but may be ignored when parsing it. |
||
64 | * |
||
65 | * @param string $string |
||
66 | * |
||
67 | * @return string |
||
68 | * @throws \Crossjoin\Json\Exception\InvalidArgumentException |
||
69 | */ |
||
70 | public function removeByteOrderMark($string) |
||
89 | |||
90 | /** |
||
91 | * @return NativeJsonErrorException |
||
92 | */ |
||
93 | protected function getNativeJsonErrorException() |
||
101 | |||
102 | /** |
||
103 | * @param $string |
||
104 | * @param $fromEncoding |
||
105 | * @param $toEncoding |
||
106 | * |
||
107 | * @return string|null |
||
108 | * @throws \Crossjoin\Json\Exception\ConversionFailedException |
||
109 | */ |
||
110 | private function convertWithIconv($string, $fromEncoding, $toEncoding) |
||
123 | |||
124 | /** |
||
125 | * @param $string |
||
126 | * @param $fromEncoding |
||
127 | * @param $toEncoding |
||
128 | * |
||
129 | * @return string|null |
||
130 | */ |
||
131 | private function convertWithUConverter($string, $fromEncoding, $toEncoding) |
||
143 | |||
144 | /** |
||
145 | * @param $string |
||
146 | * @param $fromEncoding |
||
147 | * @param $toEncoding |
||
148 | * |
||
149 | * @return string|null |
||
150 | */ |
||
151 | private function convertWithMultiByteString($string, $fromEncoding, $toEncoding) |
||
160 | } |
||
161 |