Total Complexity | 3 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 57.89% |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
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 | 6 | private function __construct() |
|
15 | { |
||
16 | 6 | } |
|
17 | |||
18 | /** |
||
19 | * Hydrate from Dynadot's response data. |
||
20 | * |
||
21 | * @param array<string,mixed> $data |
||
22 | * @return self |
||
23 | */ |
||
24 | 6 | public static function fromArray(array $data): self |
|
25 | { |
||
26 | 6 | $dto = new self(); |
|
27 | 6 | $dto->currency = $data['currency'] ?? ''; |
|
28 | 6 | $dto->unit = $data['unit'] ?? ''; |
|
29 | 6 | $dto->registration = $data['registration'] ?? ''; |
|
30 | 6 | $dto->renewal = $data['renewal'] ?? ''; |
|
31 | 6 | $dto->transfer = $data['transfer'] ?? ''; |
|
32 | 6 | $dto->restore = $data['restore'] ?? ''; |
|
33 | |||
34 | 6 | return $dto; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return array<string, mixed> |
||
39 | */ |
||
40 | public function jsonSerialize(): array |
||
49 | ]; |
||
50 | } |
||
51 | } |
||
52 |