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 IdGeneratorInterface |
||
85 | */ |
||
86 | public function getGeneratorId(): IdGeneratorInterface |
||
90 | |||
91 | /** |
||
92 | * @param IdGeneratorInterface $idGenerator |
||
93 | */ |
||
94 | public function setIdGenerator(IdGeneratorInterface $idGenerator) |
||
98 | |||
99 | /** |
||
100 | * Make request |
||
101 | * |
||
102 | * @param string $method |
||
103 | * @param array $parameters |
||
104 | * |
||
105 | * @return $this|mixed |
||
106 | */ |
||
107 | public function call(string $method, array $parameters) |
||
130 | |||
131 | /** |
||
132 | * Make notification request |
||
133 | * |
||
134 | * @param string $method |
||
135 | * @param array $parameters |
||
136 | * |
||
137 | * @return $this|null |
||
138 | */ |
||
139 | public function notification(string $method, array $parameters) |
||
150 | |||
151 | /** |
||
152 | * Start batch request |
||
153 | * |
||
154 | * @return $this |
||
155 | */ |
||
156 | public function batch() |
||
161 | |||
162 | /** |
||
163 | * Execute batch request |
||
164 | * |
||
165 | * @return array |
||
166 | */ |
||
167 | public function batchExecute() |
||
200 | |||
201 | /** |
||
202 | * @param CallSpecifier $call |
||
203 | * |
||
204 | * @return ResultSpecifier |
||
205 | */ |
||
206 | private function execute(CallSpecifier $call): ResultSpecifier |
||
213 | } |
||
214 |