Total Complexity | 3 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
5 | final class PriceList implements DtoInterface |
||
6 | { |
||
7 | public string $currency; |
||
8 | public string $unit; |
||
9 | public string $transfer; |
||
10 | public string $restore; |
||
11 | public string $registration; |
||
12 | public string $renewal; |
||
13 | |||
14 | private function __construct() {} |
||
15 | |||
16 | /** |
||
17 | * Hydrate from Dynadot's response data. |
||
18 | * |
||
19 | * @param array<string,mixed> $data |
||
20 | * @return self |
||
21 | */ |
||
22 | public static function fromArray(array $data): self |
||
23 | { |
||
24 | $dto = new self(); |
||
25 | $dto->currency = $data['currency'] ?? ''; |
||
26 | $dto->unit = $data['unit'] ?? ''; |
||
27 | $dto->registration = $data['registration'] ?? ''; |
||
28 | $dto->renewal = $data['renewal'] ?? ''; |
||
29 | $dto->transfer = $data['transfer'] ?? ''; |
||
30 | $dto->restore = $data['restore'] ?? ''; |
||
31 | return $dto; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return array<string, mixed> |
||
36 | */ |
||
37 | public function jsonSerialize(): array |
||
46 | ]; |
||
47 | } |
||
48 | } |