1 | <?php |
||
21 | class RequestDeserializationHandler implements EventSubscriberInterface |
||
22 | { |
||
23 | |||
24 | const NO_VALIDATE = 'no_validate'; |
||
25 | |||
26 | /** |
||
27 | * @var Validator $validator |
||
28 | */ |
||
29 | private $validator; |
||
30 | |||
31 | /** |
||
32 | * @var Purifier $purifier |
||
33 | */ |
||
34 | private $purifier; |
||
35 | |||
36 | /** |
||
37 | * Recursively converts object to array |
||
38 | * |
||
39 | * @param \stdClass $data |
||
40 | * |
||
41 | * @return array |
||
42 | */ |
||
43 | private function pack(\stdClass $data) |
||
47 | |||
48 | /** |
||
49 | * Recursively converts array to object |
||
50 | * |
||
51 | * @param array|\stdClass $data |
||
52 | * |
||
53 | * @return \stdClass |
||
54 | */ |
||
55 | private function unpack($data) |
||
61 | |||
62 | /** |
||
63 | * RequestDeserializationHandler constructor. |
||
64 | * |
||
65 | * @param Validator $validator |
||
66 | * @param Purifier $purifier |
||
67 | */ |
||
68 | public function __construct(Validator $validator, Purifier $purifier) |
||
73 | |||
74 | /** |
||
75 | * @inheritdoc |
||
76 | */ |
||
77 | public static function getSubscribedEvents() |
||
84 | |||
85 | /** |
||
86 | * @param PreDeserializeEvent $event |
||
87 | * |
||
88 | * @return PreDeserializeEvent |
||
89 | */ |
||
90 | public function sanitize(PreDeserializeEvent $event) |
||
106 | |||
107 | /** |
||
108 | * @param PreDeserializeEvent $event |
||
109 | * |
||
110 | * @return PreDeserializeEvent |
||
111 | * @throws \ReflectionException |
||
112 | * |
||
113 | * @throws \JsonSchema\Exception\ExceptionInterface |
||
114 | * @throws \Dingo\Api\Exception\ValidationHttpException |
||
115 | */ |
||
116 | public function validate(PreDeserializeEvent $event) |
||
160 | |||
161 | } |
||
162 |