give
/
vendor
/
vendor-prefixed
/
stellarwp
/
licensing-api-client
/
src
/
Responses
/
Token
/
Auth.php
give
/
vendor
/
vendor-prefixed
/
stellarwp
/
licensing-api-client
/
src
/
Responses
/
Token
Last commit date
ValueObjects
3 months ago
Auth.php
3 months ago
TokenList.php
3 months ago
Auth.php
33 lines
| 1 | <?php declare(strict_types=1); |
| 2 | |
| 3 | namespace Give\Vendors\LiquidWeb\LicensingApiClient\Responses\Token; |
| 4 | |
| 5 | use Give\Vendors\LiquidWeb\LicensingApiClient\Responses\Contracts\Response; |
| 6 | |
| 7 | /** |
| 8 | * Represents a token authorization check response. |
| 9 | * |
| 10 | * @implements Response<array{authorized: bool}> |
| 11 | */ |
| 12 | final class Auth implements Response |
| 13 | { |
| 14 | public bool $authorized; |
| 15 | |
| 16 | private function __construct(bool $authorized) { |
| 17 | $this->authorized = $authorized; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * @param array{authorized: bool} $attributes |
| 22 | */ |
| 23 | public static function from(array $attributes): self { |
| 24 | return new self($attributes['authorized']); |
| 25 | } |
| 26 | |
| 27 | public function toArray(): array { |
| 28 | return [ |
| 29 | 'authorized' => $this->authorized, |
| 30 | ]; |
| 31 | } |
| 32 | } |
| 33 |