PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.11
Booking for Appointments and Events Calendar – Amelia v1.2.11
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Domain / Entity / User / AbstractUser.php
ameliabooking / src / Domain / Entity / User Last commit date
AbstractUser.php 2 years ago Admin.php 7 years ago Customer.php 1 year ago Manager.php 7 years ago Provider.php 2 years ago
AbstractUser.php
391 lines
1 <?php
2
3 namespace AmeliaBooking\Domain\Entity\User;
4
5 use AmeliaBooking\Domain\ValueObjects\DateTime\Birthday;
6 use AmeliaBooking\Domain\ValueObjects\Json;
7 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
8 use AmeliaBooking\Domain\ValueObjects\Picture;
9 use AmeliaBooking\Domain\ValueObjects\String\Description;
10 use AmeliaBooking\Domain\ValueObjects\String\Email;
11 use AmeliaBooking\Domain\ValueObjects\String\Name;
12 use AmeliaBooking\Domain\ValueObjects\String\Password;
13 use AmeliaBooking\Domain\ValueObjects\String\Phone;
14 use AmeliaBooking\Domain\ValueObjects\String\Status;
15
16 /**
17 * Class AbstractUser
18 *
19 * @package AmeliaBooking\Domain\Entity\User
20 *
21 */
22 abstract class AbstractUser
23 {
24 const USER_ROLE_ADMIN = 'admin';
25 const USER_ROLE_PROVIDER = 'provider';
26 const USER_ROLE_MANAGER = 'manager';
27 const USER_ROLE_CUSTOMER = 'customer';
28
29 /** @var Description */
30 private $note;
31
32 /** @var Id */
33 private $id;
34
35 /** @var Status */
36 private $status;
37
38 /** @var Name */
39 protected $firstName;
40
41 /** @var Name */
42 protected $lastName;
43
44 /** @var Birthday */
45 protected $birthday;
46
47 /** @var Picture */
48 protected $picture;
49
50 /** @var Id */
51 protected $externalId;
52
53 /** @var Email */
54 protected $email;
55
56 /** @var Phone */
57 protected $phone;
58
59 /** @var Password */
60 private $password;
61
62 /** @var Json */
63 private $usedTokens;
64
65 /** @var int */
66 private $loginType;
67
68 /** @var Name */
69 private $zoomUserId;
70
71 /** @var Name */
72 private $countryPhoneIso;
73
74 /** @var Json */
75 protected $translations;
76
77 /**
78 * AbstractUser constructor.
79 *
80 * @param Name $firstName
81 * @param Name $lastName
82 * @param Email $email
83 */
84 public function __construct(
85 Name $firstName,
86 Name $lastName,
87 Email $email
88 ) {
89 $this->firstName = $firstName;
90 $this->lastName = $lastName;
91 $this->email = $email;
92 }
93
94 /**
95 * @return Id
96 */
97 public function getId()
98 {
99 return $this->id;
100 }
101
102 /**
103 * @param Id $id
104 */
105 public function setId(Id $id)
106 {
107 $this->id = $id;
108 }
109
110 /**
111 * @return Status
112 */
113 public function getStatus()
114 {
115 return $this->status;
116 }
117
118 /**
119 * @param Status $status
120 */
121 public function setStatus(Status $status)
122 {
123 $this->status = $status;
124 }
125
126 /**
127 * @return Name
128 */
129 public function getFirstName()
130 {
131 return $this->firstName;
132 }
133
134 /**
135 * @param Name $firstName
136 */
137 public function setFirstName(Name $firstName)
138 {
139 $this->firstName = $firstName;
140 }
141
142 /**
143 * @return Name
144 */
145 public function getLastName()
146 {
147 return $this->lastName;
148 }
149
150 /**
151 * @param Name $lastName
152 */
153 public function setLastName(Name $lastName)
154 {
155 $this->lastName = $lastName;
156 }
157
158 /**
159 * @return string
160 */
161 public function getFullName()
162 {
163 return $this->firstName->getValue() . ' ' . $this->lastName->getValue();
164 }
165
166 /**
167 * @return Birthday
168 */
169 public function getBirthday()
170 {
171 return $this->birthday;
172 }
173
174 /**
175 * @param Birthday $birthday
176 */
177 public function setBirthday(Birthday $birthday)
178 {
179 $this->birthday = $birthday;
180 }
181
182 /**
183 * @return Picture
184 */
185 public function getPicture()
186 {
187 return $this->picture;
188 }
189
190 /**
191 * @param Picture $picture
192 */
193 public function setPicture(Picture $picture)
194 {
195 $this->picture = $picture;
196 }
197
198 /**
199 * @return ID
200 */
201 public function getExternalId()
202 {
203 return $this->externalId;
204 }
205
206 /**
207 * @param ID $externalId
208 */
209 public function setExternalId(Id $externalId)
210 {
211 $this->externalId = $externalId;
212 }
213
214 /**
215 * @return Email
216 */
217 public function getEmail()
218 {
219 return $this->email;
220 }
221
222 /**
223 * @param Email $email
224 */
225 public function setEmail(Email $email)
226 {
227 $this->email = $email;
228 }
229
230 /**
231 * @return Phone
232 */
233 public function getPhone()
234 {
235 return $this->phone;
236 }
237
238 /**
239 * @param Phone $phone
240 */
241 public function setPhone(Phone $phone)
242 {
243 $this->phone = $phone;
244 }
245
246 /**
247 * Get the user type in a string form
248 */
249 public function getType()
250 {
251 return self::USER_ROLE_CUSTOMER;
252 }
253
254 /**
255 * @return Description
256 */
257 public function getNote()
258 {
259 return $this->note;
260 }
261
262 /**
263 * @param Description $note
264 */
265 public function setNote(Description $note)
266 {
267 $this->note = $note;
268 }
269
270 /**
271 * @return Name
272 */
273 public function getZoomUserId()
274 {
275 return $this->zoomUserId;
276 }
277
278 /**
279 * @param Name $zoomUserId
280 */
281 public function setZoomUserId(Name $zoomUserId)
282 {
283 $this->zoomUserId = $zoomUserId;
284 }
285
286 /**
287 * @return Password
288 */
289 public function getPassword()
290 {
291 return $this->password;
292 }
293
294 /**
295 * @param Password $password
296 */
297 public function setPassword($password)
298 {
299 $this->password = $password;
300 }
301
302 /**
303 * @return Json
304 */
305 public function getUsedTokens()
306 {
307 return $this->usedTokens;
308 }
309
310 /**
311 * @param Json $usedTokens
312 */
313 public function setUsedTokens($usedTokens)
314 {
315 $this->usedTokens = $usedTokens;
316 }
317
318 /**
319 * @return int
320 */
321 public function getLoginType()
322 {
323 return $this->loginType;
324 }
325
326 /**
327 * @param int $loginType
328 */
329 public function setLoginType($loginType)
330 {
331 $this->loginType = $loginType;
332 }
333
334 /**
335 * @return Name
336 */
337 public function getCountryPhoneIso()
338 {
339 return $this->countryPhoneIso;
340 }
341
342 /**
343 * @param Name $countryPhoneIso
344 */
345 public function setCountryPhoneIso(Name $countryPhoneIso)
346 {
347 $this->countryPhoneIso = $countryPhoneIso;
348 }
349
350 /**
351 * @return Json
352 */
353 public function getTranslations()
354 {
355 return $this->translations;
356 }
357
358 /**
359 * @param Json $translations
360 */
361 public function setTranslations(Json $translations)
362 {
363 $this->translations = $translations;
364 }
365
366 /**
367 * @return array
368 */
369 public function toArray()
370 {
371 return [
372 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
373 'firstName' => $this->getFirstName()->getValue(),
374 'lastName' => $this->getLastName()->getValue(),
375 'birthday' => null !== $this->getBirthday() ? $this->getBirthday()->getValue() : null,
376 'email' => $this->getEmail() ? $this->getEmail()->getValue() : null,
377 'phone' => null !== $this->getPhone() ? $this->getPhone()->getValue() : null,
378 'type' => $this->getType(),
379 'status' => null !== $this->getStatus() ? $this->getStatus()->getValue() : null,
380 'note' => null !== $this->getNote() ? $this->getNote()->getValue() : null,
381 'zoomUserId' => null !== $this->getZoomUserId() ? $this->getZoomUserId()->getValue() : null,
382 'countryPhoneIso' => null !== $this->getCountryPhoneIso() ? $this->getCountryPhoneIso()->getValue() : null,
383 'externalId' => null !== $this->getExternalId() ? $this->getExternalId()->getValue() : null,
384 'pictureFullPath' => null !== $this->getPicture() ? $this->getPicture()->getFullPath() : null,
385 'pictureThumbPath' => null !== $this->getPicture() ? $this->getPicture()->getThumbPath() : null,
386 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null,
387 // 'password' => null !== $this->getPassword() ? $this->getPassword()->getValue() : null
388 ];
389 }
390 }
391