Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2.004 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 1 | public function createRequest( |
|
19 | RequestInterface $request, |
||
20 | OpenIDClient $client, |
||
21 | array $claims |
||
22 | ): RequestInterface { |
||
23 | 1 | $clientId = $client->getMetadata()->getClientId(); |
|
24 | 1 | $clientSecret = $client->getMetadata()->getClientSecret(); |
|
25 | |||
26 | 1 | if (! $clientSecret) { |
|
27 | throw new InvalidArgumentException($this->getSupportedMethod() . ' cannot be used without client_secret metadata'); |
||
28 | } |
||
29 | |||
30 | 1 | $request = $request->withHeader( |
|
31 | 1 | 'Authentication', |
|
32 | 1 | 'Basic ' . \base64_encode($clientId . ':' . $clientSecret) |
|
33 | ); |
||
34 | |||
35 | 1 | $request->getBody()->write(\http_build_query($claims)); |
|
36 | |||
37 | 1 | return $request; |
|
38 | } |
||
40 |