|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace Shoman4eg\Nalog\Model\User; |
|
5
|
|
|
|
|
6
|
|
|
use Shoman4eg\Nalog\Model\CreatableFromArray; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @author Artem Dubinin <[email protected]> |
|
10
|
|
|
*/ |
|
11
|
|
|
final class UserType implements CreatableFromArray |
|
12
|
|
|
{ |
|
13
|
|
|
private ?string $lastName; |
|
14
|
|
|
private int $id; |
|
15
|
|
|
private string $displayName; |
|
16
|
|
|
private ?string $middleName; |
|
17
|
|
|
private ?string $email; |
|
18
|
|
|
private string $phone; |
|
19
|
|
|
private string $inn; |
|
20
|
|
|
private ?string $snils; |
|
21
|
|
|
private bool $avatarExists; |
|
22
|
|
|
private ?\DateTimeInterface $initialRegistrationDate; |
|
23
|
|
|
private ?\DateTimeInterface $registrationDate; |
|
24
|
|
|
private ?\DateTimeInterface $firstReceiptRegisterTime; |
|
25
|
|
|
private ?\DateTimeInterface $firstReceiptCancelTime; |
|
26
|
|
|
private bool $hideCancelledReceipt; |
|
27
|
|
|
|
|
28
|
|
|
/** @var mixed */ |
|
29
|
|
|
private $registerAvailable; |
|
30
|
|
|
|
|
31
|
|
|
private ?string $status; |
|
32
|
|
|
private bool $restrictedMode; |
|
33
|
|
|
private ?string $pfrUrl; |
|
34
|
|
|
private ?string $login; |
|
35
|
|
|
|
|
36
|
|
|
final private function __construct() {} |
|
37
|
|
|
|
|
38
|
|
|
public static function createFromArray(array $data): self |
|
39
|
|
|
{ |
|
40
|
|
|
$model = new self(); |
|
41
|
|
|
$model->id = $data['id']; |
|
42
|
|
|
$model->lastName = $data['lastName']; |
|
43
|
|
|
$model->displayName = $data['displayName']; |
|
44
|
|
|
$model->middleName = $data['middleName']; |
|
45
|
|
|
$model->email = $data['email'] ?? null; |
|
46
|
|
|
$model->phone = $data['phone']; |
|
47
|
|
|
$model->inn = $data['inn']; |
|
48
|
|
|
$model->snils = $data['snils']; |
|
49
|
|
|
$model->avatarExists = $data['avatarExists']; |
|
50
|
|
|
$model->initialRegistrationDate = $data['initialRegistrationDate'] !== null |
|
51
|
|
|
? new \DateTimeImmutable($data['initialRegistrationDate']) |
|
52
|
|
|
: null; |
|
53
|
|
|
$model->registrationDate = $data['registrationDate'] !== null |
|
54
|
|
|
? new \DateTimeImmutable($data['registrationDate']) |
|
55
|
|
|
: null; |
|
56
|
|
|
$model->firstReceiptRegisterTime = $data['firstReceiptRegisterTime'] !== null |
|
57
|
|
|
? new \DateTimeImmutable($data['firstReceiptRegisterTime']) |
|
58
|
|
|
: null; |
|
59
|
|
|
$model->firstReceiptCancelTime = $data['firstReceiptCancelTime'] !== null |
|
60
|
|
|
? new \DateTimeImmutable($data['firstReceiptCancelTime']) |
|
61
|
|
|
: null; |
|
62
|
|
|
$model->hideCancelledReceipt = $data['hideCancelledReceipt']; |
|
63
|
|
|
$model->registerAvailable = $data['registerAvailable']; |
|
64
|
|
|
$model->status = $data['status']; |
|
65
|
|
|
$model->restrictedMode = $data['restrictedMode']; |
|
66
|
|
|
$model->pfrUrl = $data['pfrUrl']; |
|
67
|
|
|
$model->login = $data['login']; |
|
68
|
|
|
|
|
69
|
|
|
return $model; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function getId(): int |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->id; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function getInn(): string |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->inn; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getLastName(): ?string |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->lastName; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function getDisplayName(): string |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->displayName; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function isHideCancelledReceipt(): bool |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->hideCancelledReceipt; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @return mixed |
|
99
|
|
|
*/ |
|
100
|
|
|
public function getRegisterAvailable() |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->registerAvailable; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function getMiddleName(): ?string |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->middleName; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function getEmail(): ?string |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->email; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
public function getPhone(): string |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->phone; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function isAvatarExists(): bool |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->avatarExists; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public function getInitialRegistrationDate(): ?\DateTimeInterface |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->initialRegistrationDate; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function getRegistrationDate(): ?\DateTimeInterface |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->registrationDate; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function getFirstReceiptRegisterTime(): ?\DateTimeInterface |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->firstReceiptRegisterTime; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
public function getFirstReceiptCancelTime(): ?\DateTimeInterface |
|
141
|
|
|
{ |
|
142
|
|
|
return $this->firstReceiptCancelTime; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
public function getStatus(): ?string |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->status; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public function isRestrictedMode(): bool |
|
151
|
|
|
{ |
|
152
|
|
|
return $this->restrictedMode; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
public function getPfrUrl(): ?string |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->pfrUrl; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
public function getLogin(): ?string |
|
161
|
|
|
{ |
|
162
|
|
|
return $this->login; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
public function getSnils(): ?string |
|
166
|
|
|
{ |
|
167
|
|
|
return $this->snils; |
|
168
|
|
|
} |
|
169
|
|
|
} |
|
170
|
|
|
|