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