1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Level23\Dynadot\Dto; |
4
|
|
|
|
5
|
|
|
final class DefaultNameServerSettings implements DtoInterface |
6
|
|
|
{ |
7
|
|
|
public string $type; |
8
|
|
|
public string $withAds; |
9
|
|
|
public string $forwardTo; |
10
|
|
|
public string $forwardType; |
11
|
|
|
public string $websiteTitle; |
12
|
|
|
public string $ttl; |
13
|
|
|
public EmailForwarding $emailForwarding; |
14
|
|
|
|
15
|
1 |
|
public function __construct( |
16
|
|
|
string $type = '', |
17
|
|
|
string $withAds = '', |
18
|
|
|
string $forwardTo = '', |
19
|
|
|
string $forwardType = '', |
20
|
|
|
string $websiteTitle = '', |
21
|
|
|
string $ttl = '', |
22
|
|
|
?EmailForwarding $emailForwarding = null |
23
|
|
|
) { |
24
|
1 |
|
$this->type = $type; |
25
|
1 |
|
$this->withAds = $withAds; |
26
|
1 |
|
$this->forwardTo = $forwardTo; |
27
|
1 |
|
$this->forwardType = $forwardType; |
28
|
1 |
|
$this->websiteTitle = $websiteTitle; |
29
|
1 |
|
$this->ttl = $ttl; |
30
|
1 |
|
$this->emailForwarding = $emailForwarding ?? new EmailForwarding(); |
31
|
|
|
} |
32
|
|
|
|
33
|
1 |
|
public static function fromArray(array $data): self |
34
|
|
|
{ |
35
|
1 |
|
return new self( |
36
|
1 |
|
$data['type'] ?? '', |
37
|
1 |
|
$data['with_ads'] ?? '', |
38
|
1 |
|
$data['forward_to'] ?? '', |
39
|
1 |
|
$data['forward_type'] ?? '', |
40
|
1 |
|
$data['website_title'] ?? '', |
41
|
1 |
|
$data['ttl'] ?? '', |
42
|
1 |
|
isset($data['email_forwarding']) ? EmailForwarding::fromArray($data['email_forwarding']) : new EmailForwarding() |
43
|
1 |
|
); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return array<string, mixed> |
48
|
|
|
*/ |
49
|
|
|
public function jsonSerialize(): array |
50
|
|
|
{ |
51
|
|
|
return [ |
52
|
|
|
'type' => $this->type, |
53
|
|
|
'with_ads' => $this->withAds, |
54
|
|
|
'forward_to' => $this->forwardTo, |
55
|
|
|
'forward_type' => $this->forwardType, |
56
|
|
|
'website_title' => $this->websiteTitle, |
57
|
|
|
'ttl' => $this->ttl, |
58
|
|
|
'email_forwarding' => $this->emailForwarding->jsonSerialize(), |
59
|
|
|
]; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|