| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 15 | public function requestToken( |
|
| 25 | #[\SensitiveParameter] ?string $clientId = null, |
||
| 26 | #[\SensitiveParameter] ?string $clientSecret = null, |
||
| 27 | array $guzzleOptions = [] |
||
| 28 | ): AccessToken { |
||
| 29 | 15 | $parameters = ['grant_type' => 'client_credentials']; |
|
| 30 | |||
| 31 | 15 | $response = $this->client->post( |
|
| 32 | 15 | $this->client->getAccountsUrl()->withPath('/connect/token'), |
|
| 33 | [ |
||
| 34 | 5 | RequestOptions::FORM_PARAMS => $parameters, |
|
| 35 | RequestOptions::AUTH => [ |
||
| 36 | 15 | $clientId ?? $this->clientId, |
|
| 37 | 15 | $clientSecret ?? $this->clientSecret, |
|
| 38 | ], |
||
| 39 | ...$guzzleOptions, |
||
| 40 | ] |
||
| 41 | ); |
||
| 42 | |||
| 43 | /** @phpstan-ignore-next-line */ |
||
| 44 | 15 | return new AccessToken(...$response); |
|
| 45 | } |
||
| 47 |