1 | <?php |
||
25 | class Client |
||
26 | { |
||
27 | /** |
||
28 | * @var AbstractInvoke[] |
||
29 | */ |
||
30 | private $units = []; |
||
31 | |||
32 | /** |
||
33 | * @var bool |
||
34 | */ |
||
35 | private $isSingleRequest = true; |
||
36 | |||
37 | /** |
||
38 | * @var RequestBuilder |
||
39 | */ |
||
40 | private $requestBuilder; |
||
41 | |||
42 | /** |
||
43 | * @var AbstractTransport |
||
44 | */ |
||
45 | private $transport; |
||
46 | |||
47 | /** |
||
48 | * @var ResponseParser |
||
49 | */ |
||
50 | private $responseParser; |
||
51 | |||
52 | /** |
||
53 | * @var IdGeneratorInterface |
||
54 | */ |
||
55 | private $generatorId; |
||
56 | |||
57 | /** |
||
58 | * Client constructor. |
||
59 | * |
||
60 | * @param string $url |
||
61 | */ |
||
62 | public function __construct(string $url) |
||
69 | |||
70 | /** |
||
71 | * @return RequestBuilder |
||
72 | */ |
||
73 | public function getRequestBuilder(): RequestBuilder |
||
77 | |||
78 | /** |
||
79 | * @return AbstractTransport |
||
80 | */ |
||
81 | public function getTransport(): AbstractTransport |
||
85 | |||
86 | /** |
||
87 | * Set transport engine |
||
88 | * |
||
89 | * @param AbstractTransport $transport |
||
90 | */ |
||
91 | public function setTransport(AbstractTransport $transport) |
||
95 | |||
96 | /** |
||
97 | * @return ResponseParser |
||
98 | */ |
||
99 | public function getResponseParser() |
||
103 | |||
104 | /** |
||
105 | * @param ResponseParser $responseParser |
||
106 | */ |
||
107 | public function setResponseParser($responseParser) |
||
111 | |||
112 | /** |
||
113 | * @return IdGeneratorInterface |
||
114 | */ |
||
115 | public function getGeneratorId(): IdGeneratorInterface |
||
119 | |||
120 | /** |
||
121 | * @param IdGeneratorInterface $idGenerator |
||
122 | */ |
||
123 | public function setIdGenerator(IdGeneratorInterface $idGenerator) |
||
127 | |||
128 | /** |
||
129 | * Make request |
||
130 | * |
||
131 | * @param string $method |
||
132 | * @param array $parameters |
||
133 | * |
||
134 | * @return $this|mixed |
||
135 | */ |
||
136 | public function call(string $method, array $parameters) |
||
159 | |||
160 | /** |
||
161 | * Make notification request |
||
162 | * |
||
163 | * @param string $method |
||
164 | * @param array $parameters |
||
165 | * |
||
166 | * @return $this|null |
||
167 | */ |
||
168 | public function notification(string $method, array $parameters) |
||
179 | |||
180 | /** |
||
181 | * Start batch request |
||
182 | * |
||
183 | * @return $this |
||
184 | */ |
||
185 | public function batch() |
||
190 | |||
191 | /** |
||
192 | * Execute batch request |
||
193 | * |
||
194 | * @return array |
||
195 | */ |
||
196 | public function batchExecute() |
||
229 | |||
230 | /** |
||
231 | * @param InvokeSpec $call |
||
232 | * |
||
233 | * @return ResultSpec |
||
234 | */ |
||
235 | private function execute(InvokeSpec $call): ResultSpec |
||
242 | } |
||
243 |