1 | <?php |
||
26 | final class HttpClientConfigurator |
||
27 | { |
||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $endpoint = 'https://api.mailgun.net'; |
||
32 | |||
33 | /** |
||
34 | * If debug is true we will send all the request to the endpoint without appending any path. |
||
35 | * |
||
36 | * @var bool |
||
37 | */ |
||
38 | private $debug = false; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | private $apiKey; |
||
44 | |||
45 | /** |
||
46 | * @var UriFactory |
||
47 | */ |
||
48 | private $uriFactory; |
||
49 | |||
50 | /** |
||
51 | * @var HttpClient |
||
52 | */ |
||
53 | private $httpClient; |
||
54 | |||
55 | /** |
||
56 | * @var History |
||
57 | */ |
||
58 | private $responseHistory; |
||
59 | |||
60 | 6 | public function __construct() |
|
64 | |||
65 | /** |
||
66 | * @return PluginClient |
||
67 | */ |
||
68 | 6 | public function createConfiguredClient() |
|
85 | |||
86 | /** |
||
87 | * @param bool $debug |
||
88 | * |
||
89 | * @return HttpClientConfigurator |
||
90 | */ |
||
91 | public function setDebug($debug) |
||
97 | |||
98 | /** |
||
99 | * @param string $endpoint |
||
100 | * |
||
101 | * @return HttpClientConfigurator |
||
102 | */ |
||
103 | public function setEndpoint($endpoint) |
||
109 | |||
110 | /** |
||
111 | * @return string |
||
112 | */ |
||
113 | 6 | private function getApiKey() |
|
117 | |||
118 | /** |
||
119 | * @param string $apiKey |
||
120 | * |
||
121 | * @return HttpClientConfigurator |
||
122 | */ |
||
123 | 6 | public function setApiKey($apiKey) |
|
129 | |||
130 | /** |
||
131 | * @return UriFactory |
||
132 | */ |
||
133 | 6 | private function getUriFactory() |
|
141 | |||
142 | /** |
||
143 | * @param UriFactory $uriFactory |
||
144 | * |
||
145 | * @return HttpClientConfigurator |
||
146 | */ |
||
147 | public function setUriFactory(UriFactory $uriFactory) |
||
153 | |||
154 | /** |
||
155 | * @return HttpClient |
||
156 | */ |
||
157 | 6 | private function getHttpClient() |
|
165 | |||
166 | /** |
||
167 | * @param HttpClient $httpClient |
||
168 | * |
||
169 | * @return HttpClientConfigurator |
||
170 | */ |
||
171 | public function setHttpClient(HttpClient $httpClient) |
||
177 | |||
178 | /** |
||
179 | * @return History |
||
180 | */ |
||
181 | public function getResponseHistory() |
||
185 | } |
||
186 |