1 | <?php |
||
14 | class DockerClient implements HttpClient |
||
15 | { |
||
16 | /** |
||
17 | * @var HttpClient |
||
18 | */ |
||
19 | private $httpClient; |
||
20 | |||
21 | public function __construct($socketClientOptions = []) |
||
22 | { |
||
23 | $messageFactory = new GuzzleMessageFactory(); |
||
24 | $socketClient = new SocketHttpClient($messageFactory, $socketClientOptions); |
||
25 | $lengthPlugin = new ContentLengthPlugin(); |
||
26 | $decodingPlugin = new DecoderPlugin(); |
||
27 | $errorPlugin = new ErrorPlugin(); |
||
28 | |||
29 | $this->httpClient = new PluginClient($socketClient, [ |
||
30 | $errorPlugin, |
||
31 | $lengthPlugin, |
||
32 | $decodingPlugin |
||
33 | ]); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * (@inheritdoc} |
||
38 | */ |
||
39 | 11 | public function sendRequest(RequestInterface $request) |
|
43 | |||
44 | /** |
||
45 | * @return DockerClient |
||
46 | */ |
||
47 | public static function create() |
||
53 | |||
54 | /** |
||
55 | * Create a docker client from environment variables |
||
56 | * |
||
57 | * @return DockerClient |
||
58 | * |
||
59 | * @throws \RuntimeException Throw exception when invalid environment variables are given |
||
60 | */ |
||
61 | public static function createFromEnv() |
||
87 | } |
||
88 |