1 | <?php |
||
20 | final class PluginClient implements HttpClient, HttpAsyncClient |
||
21 | { |
||
22 | /** |
||
23 | * An HTTP async client. |
||
24 | * |
||
25 | * @var HttpAsyncClient |
||
26 | */ |
||
27 | private $client; |
||
28 | |||
29 | /** |
||
30 | * The plugin chain. |
||
31 | * |
||
32 | * @var Plugin[] |
||
33 | */ |
||
34 | private $plugins; |
||
35 | |||
36 | /** |
||
37 | * A list of options. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | private $options; |
||
42 | |||
43 | /** |
||
44 | * @param HttpClient|HttpAsyncClient $client |
||
45 | * @param Plugin[] $plugins |
||
46 | * @param array $options |
||
47 | * |
||
48 | * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient |
||
49 | */ |
||
50 | 8 | public function __construct($client, array $plugins = [], array $options = []) |
|
63 | |||
64 | /** |
||
65 | * Append a plugin to the end of the queue. |
||
66 | * |
||
67 | 4 | * @param Plugin $plugin |
|
68 | */ |
||
69 | public function addPlugin(Plugin $plugin) |
||
73 | |||
74 | /** |
||
75 | * Get all active plugins. |
||
76 | * |
||
77 | * @return Plugin[] |
||
78 | 2 | */ |
|
79 | public function getPlugins() |
||
83 | |||
84 | 3 | /** |
|
85 | * Assign plugins to the client. |
||
86 | * |
||
87 | * @param Plugin[] $plugins |
||
88 | */ |
||
89 | public function setPlugins(array $plugins = []) |
||
95 | |||
96 | 2 | /** |
|
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function sendRequest(RequestInterface $request) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | public function sendAsyncRequest(RequestInterface $request) |
||
130 | 1 | ||
131 | 1 | /** |
|
132 | * Configure the plugin client. |
||
133 | 1 | * |
|
134 | 1 | * @param array $options |
|
135 | * |
||
136 | 5 | * @return array |
|
137 | 5 | */ |
|
138 | 5 | private function configure(array $options = []) |
|
147 | 5 | ||
148 | /** |
||
149 | * Create the plugin chain. |
||
150 | * |
||
151 | * @param Plugin[] $pluginList A list of plugins |
||
152 | * @param callable $clientCallable Callable making the HTTP call |
||
153 | * |
||
154 | * @return callable |
||
155 | */ |
||
156 | private function createPluginChain($pluginList, callable $clientCallable) |
||
181 | } |
||
182 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..