| Total Complexity | 8 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class ClientBuilder |
||
| 17 | { |
||
| 18 | public const V1 = 'v1'; |
||
| 19 | public const V2 = 'v2'; |
||
| 20 | public const BETA = 'beta'; |
||
| 21 | |||
| 22 | private $httpClient; |
||
| 23 | private $messageFactory; |
||
| 24 | |||
| 25 | public function __construct(?HttpClient $httpClient = null, ?MessageFactory $messageFactory = null) |
||
| 26 | { |
||
| 27 | $this->httpClient = $httpClient ?? HttpClientDiscovery::find(); |
||
| 28 | $this->messageFactory = $messageFactory ?? MessageFactoryDiscovery::find(); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function createClientV1(string $token): Client |
||
| 32 | { |
||
| 33 | return $this->create(self::V1, $token); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function createClientV2(string $token): Client |
||
| 37 | { |
||
| 38 | return $this->create(self::V2, $token); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function createClientBeta(string $token): Client |
||
| 44 | } |
||
| 45 | |||
| 46 | public function create(string $version, string $token): Client |
||
| 47 | { |
||
| 64 |