give
/
vendor
/
vendor-prefixed
/
stellarwp
/
licensing-api-client
/
src
/
Responses
/
Entitlement
/
Suspend.php
give
/
vendor
/
vendor-prefixed
/
stellarwp
/
licensing-api-client
/
src
/
Responses
/
Entitlement
Last commit date
ValueObjects
3 months ago
Cancel.php
3 months ago
Delete.php
3 months ago
Suspend.php
3 months ago
SwitchTier.php
3 months ago
Unsuspend.php
3 months ago
Upsert.php
3 months ago
Suspend.php
53 lines
| 1 | <?php declare(strict_types=1); |
| 2 | |
| 3 | namespace Give\Vendors\LiquidWeb\LicensingApiClient\Responses\Entitlement; |
| 4 | |
| 5 | use Give\Vendors\LiquidWeb\LicensingApiClient\Responses\Contracts\Response; |
| 6 | |
| 7 | /** |
| 8 | * Represents a suspended entitlement response payload. |
| 9 | * |
| 10 | * @implements Response<array{ |
| 11 | * product_slug: string, |
| 12 | * tier: string, |
| 13 | * status: string |
| 14 | * }> |
| 15 | */ |
| 16 | final class Suspend implements Response |
| 17 | { |
| 18 | public string $productSlug; |
| 19 | |
| 20 | public string $tier; |
| 21 | |
| 22 | public string $status; |
| 23 | |
| 24 | private function __construct(string $productSlug, string $tier, string $status) { |
| 25 | $this->productSlug = $productSlug; |
| 26 | $this->tier = $tier; |
| 27 | $this->status = $status; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @param array{ |
| 32 | * product_slug: string, |
| 33 | * tier: string, |
| 34 | * status: string |
| 35 | * } $attributes |
| 36 | */ |
| 37 | public static function from(array $attributes): self { |
| 38 | return new self( |
| 39 | $attributes['product_slug'], |
| 40 | $attributes['tier'], |
| 41 | $attributes['status'] |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | public function toArray(): array { |
| 46 | return [ |
| 47 | 'product_slug' => $this->productSlug, |
| 48 | 'tier' => $this->tier, |
| 49 | 'status' => $this->status, |
| 50 | ]; |
| 51 | } |
| 52 | } |
| 53 |