| Total Complexity | 6 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class AuthorizationCodeResponse |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var array<string, mixed> |
||
| 16 | */ |
||
| 17 | private $parameters; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * AuthorizationCodeResponse constructor. |
||
| 21 | * |
||
| 22 | * @param array<string, mixed> $parameters |
||
| 23 | */ |
||
| 24 | 10 | public function __construct(array $parameters) |
|
| 25 | { |
||
| 26 | 10 | $this->parameters = $parameters; |
|
| 27 | 10 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Get the authorization code |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | 4 | public function code(): string |
|
| 35 | { |
||
| 36 | 4 | return $this->parameters['code']; |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get the state |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 10 | public function state(): string |
|
| 45 | { |
||
| 46 | 10 | return $this->parameters['state'] ?? ''; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Check if the response is an error response |
||
| 51 | * |
||
| 52 | * @return bool |
||
| 53 | */ |
||
| 54 | 6 | public function isError(): bool |
|
| 55 | { |
||
| 56 | 6 | return isset($this->parameters['error']); |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Get the error code |
||
| 61 | * |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | 2 | public function error(): string |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Get the human readable error message |
||
| 71 | * |
||
| 72 | * @return string|null |
||
| 73 | */ |
||
| 74 | 2 | public function errorDescription(): ?string |
|
| 77 | } |
||
| 78 | } |
||
| 79 |