Total Complexity | 4 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | final class Configuration |
||
19 | { |
||
20 | private $plugins = []; |
||
21 | private $httpClient; |
||
22 | |||
23 | public function __construct(string $endpoint, string $token) |
||
24 | { |
||
25 | $this->plugins[] = new BaseUriPlugin((UriFactoryDiscovery::find())->createUri($endpoint)); |
||
26 | |||
27 | $this->plugins[] = new AuthenticationPlugin(new TokenAuthentication($token)); |
||
28 | } |
||
29 | |||
30 | public function setLogger(LoggerInterface $logger): self |
||
31 | { |
||
32 | $this->plugins[] = new LoggerPlugin($logger); |
||
33 | |||
34 | return $this; |
||
35 | } |
||
36 | |||
37 | public function setHttpClient(HttpClient $httpClient): self |
||
38 | { |
||
39 | $this->httpClient = $httpClient; |
||
40 | |||
41 | return $this; |
||
42 | } |
||
43 | |||
44 | public function getClient(): Client |
||
49 | } |
||
50 | } |
||
51 |