1 | <?php |
||
20 | class JsonApiViewListener |
||
21 | { |
||
22 | /** |
||
23 | * On Kernel View event handler |
||
24 | * |
||
25 | * @param GetResponseForControllerResultEvent $event |
||
26 | */ |
||
27 | 4 | public function onKernelView(GetResponseForControllerResultEvent $event) |
|
45 | |||
46 | /** |
||
47 | * Handle single resource object |
||
48 | * |
||
49 | * @param ResourceObject $resource |
||
50 | * @return Response |
||
51 | */ |
||
52 | 1 | protected function handleResource(ResourceObject $resource): Response |
|
58 | |||
59 | /** |
||
60 | * Handle error |
||
61 | * |
||
62 | * @param ErrorObject $error |
||
63 | * @return Response |
||
64 | */ |
||
65 | 1 | protected function handleError(ErrorObject $error): Response |
|
72 | |||
73 | /** |
||
74 | * Create response |
||
75 | * |
||
76 | * @param AbstractDocument $document |
||
77 | * @return Response |
||
78 | */ |
||
79 | 3 | protected function createResponse(AbstractDocument $document): Response |
|
88 | |||
89 | /** |
||
90 | * Encode object into a json-string |
||
91 | * |
||
92 | * @param mixed $object |
||
93 | * @return string |
||
94 | * @throws \LogicException |
||
95 | */ |
||
96 | 3 | protected function encode($object): string |
|
106 | } |