|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* Copyright (C) 2013 Mailgun |
|
7
|
|
|
* |
|
8
|
|
|
* This software may be modified and distributed under the terms |
|
9
|
|
|
* of the MIT license. See the LICENSE file for details. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Mailgun\Model\MailingList; |
|
13
|
|
|
|
|
14
|
|
|
use Mailgun\Model\ApiResponse; |
|
15
|
|
|
|
|
16
|
|
|
final class MailingList implements ApiResponse |
|
17
|
|
|
{ |
|
18
|
|
|
private $name; |
|
19
|
|
|
private $address; |
|
20
|
|
|
private $accessLevel; |
|
21
|
|
|
private $replyPreference; |
|
22
|
|
|
private $description; |
|
23
|
|
|
private $membersCount; |
|
24
|
|
|
private $createdAt; |
|
25
|
|
|
|
|
26
|
3 |
|
public static function create(array $data): self |
|
27
|
|
|
{ |
|
28
|
3 |
|
$model = new self(); |
|
29
|
3 |
|
$model->name = $data['name'] ?? null; |
|
30
|
3 |
|
$model->address = $data['address'] ?? null; |
|
31
|
3 |
|
$model->accessLevel = $data['access_level'] ?? null; |
|
32
|
3 |
|
$model->replyPreference = $data['reply_preference'] ?? null; |
|
33
|
3 |
|
$model->description = $data['description'] ?? null; |
|
34
|
3 |
|
$model->membersCount = (int) ($data['members_count'] ?? 0); |
|
35
|
3 |
|
$model->createdAt = isset($data['created_at']) ? new \DateTimeImmutable($data['created_at']) : null; |
|
36
|
|
|
|
|
37
|
3 |
|
return $model; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
3 |
|
private function __construct() |
|
41
|
|
|
{ |
|
42
|
3 |
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function getName(): ?string |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->name; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getAddress(): ?string |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->address; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
1 |
|
public function getAccessLevel(): ?string |
|
55
|
|
|
{ |
|
56
|
1 |
|
return $this->accessLevel; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function getReplyPreference(): ?string |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->replyPreference; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function getDescription(): ?string |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->description; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
2 |
|
public function getMembersCount(): int |
|
70
|
|
|
{ |
|
71
|
2 |
|
return $this->membersCount; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getCreatedAt(): \DateTimeImmutable |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->createdAt; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|