Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| TokenEndpointException | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Client; |
| 6 | |
| 7 | /** |
| 8 | * The token endpoint answered, but not with a token. The status and the |
| 9 | * OAuth error code (RFC 6749 ยง5.2, when the body carried one) are here so a |
| 10 | * caller can tell refused credentials (400 invalid_client, 401) from an |
| 11 | * outage (503) without parsing a sentence; DeliveryVerdict does exactly that. |
| 12 | */ |
| 13 | final class TokenEndpointException extends ClientException |
| 14 | { |
| 15 | public function __construct( |
| 16 | public readonly int $status, |
| 17 | public readonly ?string $error, |
| 18 | string $tokenUrl, |
| 19 | ) { |
| 20 | parent::__construct(\sprintf('Token endpoint %s answered %d%s.', $tokenUrl, $status, $error !== null ? ' (' . $error . ')' : '')); |
| 21 | } |
| 22 | } |