Total Complexity | 3 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 66.67% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
5 | final class DomainRegistrationResult implements DtoInterface |
||
6 | { |
||
7 | public string $domainName; |
||
8 | public int $expirationDate; |
||
9 | |||
10 | 8 | private function __construct( |
|
11 | string $domainName, |
||
12 | int $expirationDate, |
||
13 | ) { |
||
14 | 8 | $this->domainName = $domainName; |
|
15 | 8 | $this->expirationDate = $expirationDate; |
|
16 | } |
||
17 | |||
18 | /** |
||
19 | * Hydrate from Dynadot's response data. |
||
20 | * |
||
21 | * @param array<string,mixed> $data |
||
22 | * @return self |
||
23 | */ |
||
24 | 8 | public static function fromArray(array $data): self |
|
25 | { |
||
26 | 8 | return new self( |
|
27 | 8 | $data['domain_name'] ?? '', |
|
28 | 8 | $data['expiration_date'] ?? 0, |
|
29 | 8 | ); |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return array<string, mixed> |
||
34 | */ |
||
35 | public function jsonSerialize(): array |
||
40 | ]; |
||
41 | } |
||
42 | } |
||
43 |