1 | <?php |
||
13 | class Encoder extends Converter |
||
14 | { |
||
15 | const UTF16 = self::UTF16BE; |
||
16 | const UTF32 = self::UTF32BE; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $encoding = self::UTF8; |
||
22 | |||
23 | /** |
||
24 | * Encoder constructor. |
||
25 | * |
||
26 | * @param string $encoding |
||
27 | * @throws \Crossjoin\Json\Exception\EncodingNotSupportedException |
||
28 | * @throws \Crossjoin\Json\Exception\InvalidArgumentException |
||
29 | */ |
||
30 | public function __construct($encoding = self::UTF8) |
||
34 | |||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getEncoding() |
||
42 | |||
43 | /** |
||
44 | * @param string $encoding |
||
45 | * |
||
46 | * @throws \Crossjoin\Json\Exception\EncodingNotSupportedException |
||
47 | * @throws \Crossjoin\Json\Exception\InvalidArgumentException |
||
48 | */ |
||
49 | public function setEncoding($encoding) |
||
61 | |||
62 | /** |
||
63 | * @param mixed $value |
||
64 | * @param int $options |
||
65 | * @param int $depth |
||
66 | * |
||
67 | * @return string |
||
68 | * @throws \Crossjoin\Json\Exception\NativeJsonErrorException |
||
69 | * @throws \Crossjoin\Json\Exception\InvalidArgumentException |
||
70 | * @throws \Crossjoin\Json\Exception\ExtensionRequiredException |
||
71 | * @throws \Crossjoin\Json\Exception\ConversionFailedException |
||
72 | */ |
||
73 | public function encode($value, $options = 0, $depth = 512) |
||
100 | |||
101 | /** |
||
102 | * @param mixed $value |
||
103 | * @param int $options |
||
104 | * @param int $depth |
||
105 | * |
||
106 | * @return string |
||
107 | * @throws \Crossjoin\Json\Exception\NativeJsonErrorException |
||
108 | */ |
||
109 | private function encodePhpGte55($value, $options, $depth) |
||
119 | |||
120 | /** |
||
121 | * @param mixed $value |
||
122 | * @param int $options |
||
123 | * |
||
124 | * @return string |
||
125 | * @throws \Crossjoin\Json\Exception\NativeJsonErrorException |
||
126 | * @throws \Crossjoin\Json\Exception\InvalidArgumentException |
||
127 | */ |
||
128 | private function encodePhpLt55($value, $options) |
||
144 | } |
||
145 |