| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | 1 | public function build(string $apiKey, string $workspace, $options = array()): Client |
|
| 31 | { |
||
| 32 | 1 | $resolver = new OptionsResolver(); |
|
| 33 | 1 | $this->configureOptions($resolver); |
|
| 34 | 1 | $resolvedOptions = $resolver->resolve($options); |
|
| 35 | |||
| 36 | // Merge guzzle options and override with our own |
||
| 37 | 1 | $options = $resolvedOptions['guzzle_options']; |
|
| 38 | 1 | $options = array_merge($options, [ |
|
| 39 | 1 | 'base_uri' => $resolvedOptions['host'], |
|
| 40 | 1 | 'debug' => $resolvedOptions['debug'], |
|
| 41 | 'headers' => [ |
||
| 42 | 1 | 'Authorization' => "Bearer " . $apiKey, |
|
| 43 | ], |
||
| 44 | ]); |
||
| 45 | |||
| 46 | 1 | $guzzleClient = new \GuzzleHttp\Client($options); |
|
| 47 | |||
| 48 | 1 | return new Client($guzzleClient, $workspace); |
|
| 49 | } |
||
| 64 |