1 | <?php |
||
30 | abstract class AbstractEndpoint |
||
31 | { |
||
32 | /** |
||
33 | * @var EventDispatcherInterface |
||
34 | */ |
||
35 | protected $dispatcher; |
||
36 | |||
37 | /** |
||
38 | * @var EncoderInterface |
||
39 | */ |
||
40 | protected $encoder; |
||
41 | |||
42 | /** |
||
43 | * @var DecoderInterface |
||
44 | */ |
||
45 | protected $decoder; |
||
46 | |||
47 | /** |
||
48 | * @var Url |
||
49 | */ |
||
50 | protected $url; |
||
51 | |||
52 | /** |
||
53 | * @var Wsse |
||
54 | */ |
||
55 | protected $wsse; |
||
56 | |||
57 | /** |
||
58 | * Constructor class. |
||
59 | * |
||
60 | * @param EventDispatcherInterface $dispatcher The service of dispatcher. |
||
61 | * @param EncoderProviderInterface $encoderProvider Instance of provider for the encoder. |
||
62 | * @param DecoderProviderInterface $decoderProvider Instance of provider for the decoder. |
||
63 | * @param Url $url The url component for rest API. |
||
64 | * @param Wsse $wsse The generator of wsse header. |
||
65 | * @param string $requestFormat The format of request (default json). |
||
66 | * @param string $responseFormat The format of response (default json). |
||
67 | */ |
||
68 | public function __construct( |
||
83 | |||
84 | /** |
||
85 | * Calls Rest API method. |
||
86 | * |
||
87 | * @param string $event |
||
88 | * @param string $path |
||
89 | * @param array $query |
||
90 | * @param array $request |
||
91 | * @param array $server |
||
92 | * |
||
93 | * @return RestResponse |
||
94 | */ |
||
95 | public function call($event, $path = null, array $query = [], array $request = [], array $server = []) |
||
113 | |||
114 | /** |
||
115 | * Prepares a request. |
||
116 | * |
||
117 | * @param string $actionPath The path of action. |
||
118 | * @param array $query The query of url. |
||
119 | * @param array $request The body post of request. |
||
120 | * @param array $server The server parameters. |
||
121 | * |
||
122 | * @return Request |
||
123 | */ |
||
124 | protected function prepareRequest($actionPath = null, array $query = [], array $request = [], array $server = []) |
||
144 | |||
145 | /** |
||
146 | * Encodes request. |
||
147 | * |
||
148 | * @param array $request The request data (default empty). |
||
149 | * |
||
150 | * @return mixed |
||
151 | */ |
||
152 | protected function encodeRequest(array $request = []) |
||
156 | |||
157 | /** |
||
158 | * Decodes response. |
||
159 | * |
||
160 | * @param string $content The response's content (default null). |
||
161 | * |
||
162 | * @return mixed |
||
163 | */ |
||
164 | protected function decodeResponse($content = null) |
||
168 | } |
||
169 |