1 | <?php |
||
20 | class Client |
||
21 | { |
||
22 | /** |
||
23 | * @var AbstractCall[] |
||
24 | */ |
||
25 | private $units = []; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $isSingleRequest = true; |
||
31 | |||
32 | /** |
||
33 | * @var RequestBuilder |
||
34 | */ |
||
35 | private $requestBuilder; |
||
36 | |||
37 | /** |
||
38 | * @var AbstractTransport |
||
39 | */ |
||
40 | private $transport; |
||
41 | |||
42 | /** |
||
43 | * @var ResponseParser |
||
44 | */ |
||
45 | private $responseParser; |
||
46 | |||
47 | /** |
||
48 | * @var IdGeneratorInterface |
||
49 | */ |
||
50 | private $generatorId; |
||
51 | |||
52 | /** |
||
53 | * Client constructor. |
||
54 | * |
||
55 | * @param string $url |
||
56 | */ |
||
57 | public function __construct(string $url) |
||
64 | |||
65 | /** |
||
66 | * @return AbstractTransport |
||
67 | */ |
||
68 | public function getTransport(): AbstractTransport |
||
72 | |||
73 | /** |
||
74 | * Set transport engine |
||
75 | * |
||
76 | * @param AbstractTransport $transport |
||
77 | */ |
||
78 | public function setTransport(AbstractTransport $transport) |
||
82 | |||
83 | /** |
||
84 | * @return ResponseParser |
||
85 | */ |
||
86 | public function getResponseParser() |
||
90 | |||
91 | /** |
||
92 | * @param ResponseParser $responseParser |
||
93 | */ |
||
94 | public function setResponseParser($responseParser) |
||
98 | |||
99 | /** |
||
100 | * @return IdGeneratorInterface |
||
101 | */ |
||
102 | public function getGeneratorId(): IdGeneratorInterface |
||
106 | |||
107 | /** |
||
108 | * @param IdGeneratorInterface $idGenerator |
||
109 | */ |
||
110 | public function setIdGenerator(IdGeneratorInterface $idGenerator) |
||
114 | |||
115 | /** |
||
116 | * Make request |
||
117 | * |
||
118 | * @param string $method |
||
119 | * @param array $parameters |
||
120 | * |
||
121 | * @return $this|mixed |
||
122 | */ |
||
123 | public function call(string $method, array $parameters) |
||
146 | |||
147 | /** |
||
148 | * Make notification request |
||
149 | * |
||
150 | * @param string $method |
||
151 | * @param array $parameters |
||
152 | * |
||
153 | * @return $this|null |
||
154 | */ |
||
155 | public function notification(string $method, array $parameters) |
||
166 | |||
167 | /** |
||
168 | * Start batch request |
||
169 | * |
||
170 | * @return $this |
||
171 | */ |
||
172 | public function batch() |
||
177 | |||
178 | /** |
||
179 | * Execute batch request |
||
180 | * |
||
181 | * @return array |
||
182 | */ |
||
183 | public function batchExecute() |
||
216 | |||
217 | /** |
||
218 | * @param CallSpecifier $call |
||
219 | * |
||
220 | * @return ResultSpecifier |
||
221 | */ |
||
222 | private function execute(CallSpecifier $call): ResultSpecifier |
||
229 | } |
||
230 |