give
/
vendor
/
vendor-prefixed
/
stellarwp
/
licensing-api-client
/
src
/
Requests
/
Credit
/
DeletePool.php
give
/
vendor
/
vendor-prefixed
/
stellarwp
/
licensing-api-client
/
src
/
Requests
/
Credit
Last commit date
CreatePool.php
3 months ago
DeletePool.php
3 months ago
ListLedgerEntries.php
3 months ago
RecordUsage.php
3 months ago
Refund.php
3 months ago
SetQuota.php
3 months ago
UpdatePool.php
3 months ago
DeletePool.php
59 lines
| 1 | <?php declare(strict_types=1); |
| 2 | |
| 3 | namespace Give\Vendors\LiquidWeb\LicensingApiClient\Requests\Credit; |
| 4 | |
| 5 | use DateTimeImmutable; |
| 6 | use Give\Vendors\LiquidWeb\LicensingApiClient\Concerns\InteractsWithDateTime; |
| 7 | |
| 8 | /** |
| 9 | * Represents a credit pool delete request payload. |
| 10 | * |
| 11 | * @phpstan-type DeletePoolPayload array{ |
| 12 | * license_key: string, |
| 13 | * pool_id: int, |
| 14 | * expires_at?: string |
| 15 | * } |
| 16 | */ |
| 17 | final class DeletePool |
| 18 | { |
| 19 | use InteractsWithDateTime; |
| 20 | |
| 21 | /** |
| 22 | * License key that owns the credit pool. |
| 23 | * |
| 24 | * @example LWSW-8H9F-5UKA-VR3B-D7SQ-BP9N |
| 25 | */ |
| 26 | public string $licenseKey; |
| 27 | |
| 28 | /** |
| 29 | * Credit pool identifier to delete. |
| 30 | * |
| 31 | * @example 42 |
| 32 | */ |
| 33 | public int $poolId; |
| 34 | |
| 35 | /** |
| 36 | * Optional expiration timestamp to soft-delete the pool at a specific time. |
| 37 | * |
| 38 | * @example 2026-04-01T00:00:00Z |
| 39 | */ |
| 40 | public ?DateTimeImmutable $expiresAt; |
| 41 | |
| 42 | public function __construct(string $licenseKey, int $poolId, ?DateTimeImmutable $expiresAt = null) { |
| 43 | $this->licenseKey = $licenseKey; |
| 44 | $this->poolId = $poolId; |
| 45 | $this->expiresAt = $expiresAt; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * @return DeletePoolPayload |
| 50 | */ |
| 51 | public function toArray(): array { |
| 52 | return array_filter([ |
| 53 | 'license_key' => $this->licenseKey, |
| 54 | 'pool_id' => $this->poolId, |
| 55 | 'expires_at' => $this->expiresAt ? $this->formatDateTime($this->expiresAt) : null, |
| 56 | ], static fn ($value): bool => $value !== null); |
| 57 | } |
| 58 | } |
| 59 |