PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
give / vendor / vendor-prefixed / stellarwp / licensing-api-client / src / Responses / Credit / QuotaCollection.php

QuotaCollection.php in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at vendor/vendor-prefixed/stellarwp/licensing-api-client/src/Responses/Credit/QuotaCollection.php

79 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace Give\Vendors\LiquidWeb\LicensingApiClient\Responses\Credit;
4
5 use Give\Vendors\LiquidWeb\LicensingApiClient\Responses\Contracts\Response;
6 use Give\Vendors\LiquidWeb\LicensingApiClient\Responses\Credit\ValueObjects\SiteQuota;
7
8 /**
9 * Represents a collection of site quotas.
10 *
11 * @implements Response<array{
12 * quotas: list<array{
13 * domain: string,
14 * credit_type: string,
15 * quota: ?int,
16 * period: string,
17 * first_period_start: ?string,
18 * is_blocked: bool,
19 * is_uncapped: bool
20 * }>
21 * }>
22 */
23 final class QuotaCollection implements Response
24 {
25 /**
26 * @var list<SiteQuota>
27 */
28 public array $quotas;
29
30 /**
31 * @param list<SiteQuota> $quotas
32 */
33 private function __construct(array $quotas) {
34 $this->quotas = $quotas;
35 }
36
37 /**
38 * @param array{
39 * quotas: list<array{
40 * domain: string,
41 * credit_type: string,
42 * quota: ?int,
43 * period: string,
44 * first_period_start: ?string,
45 * is_blocked: bool,
46 * is_uncapped: bool
47 * }>
48 * } $attributes
49 */
50 public static function from(array $attributes): self {
51 return new self(array_map(
52 static fn (array $quota): SiteQuota => SiteQuota::from($quota),
53 $attributes['quotas']
54 ));
55 }
56
57 /**
58 * @return array{
59 * quotas: list<array{
60 * domain: string,
61 * credit_type: string,
62 * quota: ?int,
63 * period: string,
64 * first_period_start: ?string,
65 * is_blocked: bool,
66 * is_uncapped: bool
67 * }>
68 * }
69 */
70 public function toArray(): array {
71 return [
72 'quotas' => array_map(
73 static fn (SiteQuota $quota): array => $quota->toArray(),
74 $this->quotas
75 ),
76 ];
77 }
78 }
79