| Total Complexity | 3 | 
| Total Lines | 41 | 
| Duplicated Lines | 0 % | 
| Coverage | 0% | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 12 | class RestClient | ||
| 13 | { | ||
| 14 | |||
| 15 | |||
| 16 | //parameters | ||
| 17 | private string $endpoint; | ||
| 18 | private string $clientkey; | ||
| 19 | |||
| 20 | public function __construct(string $endpoint, string $clientkey) | ||
| 24 | } | ||
| 25 | |||
| 26 | private function tokenize(): mixed | ||
| 27 |     { | ||
| 28 | |||
| 29 | $body = array(); | ||
| 30 | $body['grant_type'] = 'client_credentials'; | ||
| 31 | |||
| 32 | $client = new Client(); | ||
| 33 |         $res = $client->request('POST', $this->endpoint, [ | ||
| 34 | 'headers' => [ | ||
| 35 | 'Content-Type' => 'application/x-www-form-urlencoded', | ||
| 36 | 'Accept' => '*/*', | ||
| 37 | 'Authorization' => 'Basic '.$this->clientkey, | ||
| 38 | ], | ||
| 39 | 'form_params' => ['grant_type' => 'client_credentials'], | ||
| 40 | ]); | ||
| 41 | return $res; | ||
| 42 | } | ||
| 43 | |||
| 44 | /** | ||
| 45 | * Perform a call to the principal method of token acquisition | ||
| 46 | */ | ||
| 47 | public function oauth2Principal(): mixed | ||
| 53 | } | ||
| 54 | } | ||
| 55 |