1 | <?php |
||
15 | class ObjectConverter |
||
16 | { |
||
17 | /** |
||
18 | * @var SerializerInterface |
||
19 | */ |
||
20 | private $serializer; |
||
21 | |||
22 | /** |
||
23 | * @var ValidatorInterface |
||
24 | */ |
||
25 | private $validator; |
||
26 | |||
27 | 29 | public function __construct( |
|
34 | |||
35 | /** |
||
36 | * @param string $class |
||
37 | * @param string $json |
||
38 | * |
||
39 | * @throws ValidationException |
||
40 | * @throws ParseException |
||
41 | * |
||
42 | * @return mixed |
||
43 | */ |
||
44 | 21 | public function getResponseObject(string $class, string $json) |
|
51 | |||
52 | /** |
||
53 | * @param mixed $object |
||
54 | * |
||
55 | * @throws ValidationException |
||
56 | * @throws ParseException |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 21 | public function getRequestString($object): string |
|
66 | |||
67 | 2 | /** |
|
68 | * @param string $class |
||
69 | * @param string $json |
||
70 | 2 | * |
|
71 | 1 | * @throws ParseException |
|
72 | 1 | * |
|
73 | * @return mixed |
||
74 | */ |
||
75 | private function deserialize(string $class, string $json) |
||
83 | |||
84 | 21 | /** |
|
85 | * Assert that object is valid. |
||
86 | * |
||
87 | 21 | * @param mixed $object |
|
88 | 5 | * @param int $code |
|
89 | 3 | * |
|
90 | * @throws ValidationException |
||
91 | */ |
||
92 | private function assertValid($object, int $code = 0) |
||
99 | |||
100 | /** |
||
101 | 26 | * @param mixed $object |
|
102 | * |
||
103 | 26 | * @throws ParseException |
|
104 | 26 | * |
|
105 | 6 | * @return string |
|
106 | */ |
||
107 | 22 | private function serializeBodyObject($object): string |
|
115 | |||
116 | 18 | /** |
|
117 | * @return Context |
||
118 | */ |
||
119 | 18 | private function getSerializeBodyObjectContext(): Context |
|
123 | } |
||
124 |