PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
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 1 year ago Admin.php 7 years ago Customer.php 1 year ago Manager.php 7 years ago Provider.php 2 years ago
AbstractUser.php
412 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 /** @var Name */
78 private $appleCalendarId;
79
80 /**
81 * AbstractUser constructor.
82 *
83 * @param Name $firstName
84 * @param Name $lastName
85 * @param Email $email
86 */
87 public function __construct(
88 Name $firstName,
89 Name $lastName,
90 Email $email
91 ) {
92 $this->firstName = $firstName;
93 $this->lastName = $lastName;
94 $this->email = $email;
95 }
96
97 /**
98 * @return Id
99 */
100 public function getId()
101 {
102 return $this->id;
103 }
104
105 /**
106 * @param Id $id
107 */
108 public function setId(Id $id)
109 {
110 $this->id = $id;
111 }
112
113 /**
114 * @return Status
115 */
116 public function getStatus()
117 {
118 return $this->status;
119 }
120
121 /**
122 * @param Status $status
123 */
124 public function setStatus(Status $status)
125 {
126 $this->status = $status;
127 }
128
129 /**
130 * @return Name
131 */
132 public function getFirstName()
133 {
134 return $this->firstName;
135 }
136
137 /**
138 * @param Name $firstName
139 */
140 public function setFirstName(Name $firstName)
141 {
142 $this->firstName = $firstName;
143 }
144
145 /**
146 * @return Name
147 */
148 public function getLastName()
149 {
150 return $this->lastName;
151 }
152
153 /**
154 * @param Name $lastName
155 */
156 public function setLastName(Name $lastName)
157 {
158 $this->lastName = $lastName;
159 }
160
161 /**
162 * @return string
163 */
164 public function getFullName()
165 {
166 return $this->firstName->getValue() . ' ' . $this->lastName->getValue();
167 }
168
169 /**
170 * @return Birthday
171 */
172 public function getBirthday()
173 {
174 return $this->birthday;
175 }
176
177 /**
178 * @param Birthday $birthday
179 */
180 public function setBirthday(Birthday $birthday)
181 {
182 $this->birthday = $birthday;
183 }
184
185 /**
186 * @return Picture
187 */
188 public function getPicture()
189 {
190 return $this->picture;
191 }
192
193 /**
194 * @param Picture $picture
195 */
196 public function setPicture(Picture $picture)
197 {
198 $this->picture = $picture;
199 }
200
201 /**
202 * @return ID
203 */
204 public function getExternalId()
205 {
206 return $this->externalId;
207 }
208
209 /**
210 * @param ID $externalId
211 */
212 public function setExternalId(Id $externalId)
213 {
214 $this->externalId = $externalId;
215 }
216
217 /**
218 * @return Email
219 */
220 public function getEmail()
221 {
222 return $this->email;
223 }
224
225 /**
226 * @param Email $email
227 */
228 public function setEmail(Email $email)
229 {
230 $this->email = $email;
231 }
232
233 /**
234 * @return Phone
235 */
236 public function getPhone()
237 {
238 return $this->phone;
239 }
240
241 /**
242 * @param Phone $phone
243 */
244 public function setPhone(Phone $phone)
245 {
246 $this->phone = $phone;
247 }
248
249 /**
250 * Get the user type in a string form
251 */
252 public function getType()
253 {
254 return self::USER_ROLE_CUSTOMER;
255 }
256
257 /**
258 * @return Description
259 */
260 public function getNote()
261 {
262 return $this->note;
263 }
264
265 /**
266 * @param Description $note
267 */
268 public function setNote(Description $note)
269 {
270 $this->note = $note;
271 }
272
273 /**
274 * @return Name
275 */
276 public function getZoomUserId()
277 {
278 return $this->zoomUserId;
279 }
280
281 /**
282 * @param Name $zoomUserId
283 */
284 public function setZoomUserId(Name $zoomUserId)
285 {
286 $this->zoomUserId = $zoomUserId;
287 }
288
289 /**
290 * @return Password
291 */
292 public function getPassword()
293 {
294 return $this->password;
295 }
296
297 /**
298 * @param Password $password
299 */
300 public function setPassword($password)
301 {
302 $this->password = $password;
303 }
304
305 /**
306 * @return Json
307 */
308 public function getUsedTokens()
309 {
310 return $this->usedTokens;
311 }
312
313 /**
314 * @param Json $usedTokens
315 */
316 public function setUsedTokens($usedTokens)
317 {
318 $this->usedTokens = $usedTokens;
319 }
320
321 /**
322 * @return int
323 */
324 public function getLoginType()
325 {
326 return $this->loginType;
327 }
328
329 /**
330 * @param int $loginType
331 */
332 public function setLoginType($loginType)
333 {
334 $this->loginType = $loginType;
335 }
336
337 /**
338 * @return Name
339 */
340 public function getCountryPhoneIso()
341 {
342 return $this->countryPhoneIso;
343 }
344
345 /**
346 * @param Name $countryPhoneIso
347 */
348 public function setCountryPhoneIso(Name $countryPhoneIso)
349 {
350 $this->countryPhoneIso = $countryPhoneIso;
351 }
352
353 /**
354 * @return Json
355 */
356 public function getTranslations()
357 {
358 return $this->translations;
359 }
360
361 /**
362 * @param Json $translations
363 */
364 public function setTranslations(Json $translations)
365 {
366 $this->translations = $translations;
367 }
368
369
370 /**
371 * @return Name
372 */
373 public function getAppleCalendarId()
374 {
375 return $this->appleCalendarId;
376 }
377
378 /**
379 * @param Name $appleCalendarId
380 */
381 public function setAppleCalendarId(Name $appleCalendarId)
382 {
383 $this->appleCalendarId = $appleCalendarId;
384 }
385
386 /**
387 * @return array
388 */
389 public function toArray()
390 {
391 return [
392 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
393 'firstName' => $this->getFirstName()->getValue(),
394 'lastName' => $this->getLastName()->getValue(),
395 'birthday' => null !== $this->getBirthday() ? $this->getBirthday()->getValue() : null,
396 'email' => $this->getEmail() ? $this->getEmail()->getValue() : null,
397 'phone' => null !== $this->getPhone() ? $this->getPhone()->getValue() : null,
398 'type' => $this->getType(),
399 'status' => null !== $this->getStatus() ? $this->getStatus()->getValue() : null,
400 'note' => null !== $this->getNote() ? $this->getNote()->getValue() : null,
401 'zoomUserId' => null !== $this->getZoomUserId() ? $this->getZoomUserId()->getValue() : null,
402 'countryPhoneIso' => null !== $this->getCountryPhoneIso() ? $this->getCountryPhoneIso()->getValue() : null,
403 'externalId' => null !== $this->getExternalId() ? $this->getExternalId()->getValue() : null,
404 'pictureFullPath' => null !== $this->getPicture() ? $this->getPicture()->getFullPath() : null,
405 'pictureThumbPath' => null !== $this->getPicture() ? $this->getPicture()->getThumbPath() : null,
406 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null,
407 'appleCalendarId' => null !== $this->getAppleCalendarId() ? $this->getAppleCalendarId()->getValue() : null,
408 // 'password' => null !== $this->getPassword() ? $this->getPassword()->getValue() : null
409 ];
410 }
411 }
412