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 / Customer.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
Customer.php
100 lines
1 <?php
2
3 namespace AmeliaBooking\Domain\Entity\User;
4
5 use AmeliaBooking\Domain\Entity\Stripe\StripeConnect;
6 use AmeliaBooking\Domain\ValueObjects\Gender;
7 use AmeliaBooking\Domain\ValueObjects\String\Email;
8 use AmeliaBooking\Domain\ValueObjects\String\Name;
9 use AmeliaBooking\Domain\ValueObjects\String\Phone;
10
11 /**
12 * Class Customer
13 *
14 * @package AmeliaBooking\Domain\Entity\User
15 */
16 class Customer extends AbstractUser
17 {
18 /** @var Gender */
19 private $gender;
20
21 /** @var StripeConnect */
22 private $stripeConnect;
23
24
25 /**
26 * @param Name $firstName
27 * @param Name $lastName
28 * @param Email $email
29 * @param Phone $phone
30 * @param Gender $gender
31 */
32 public function __construct(
33 Name $firstName,
34 Name $lastName,
35 Email $email,
36 Phone $phone,
37 Gender $gender
38 ) {
39 parent::__construct($firstName, $lastName, $email);
40 $this->phone = $phone;
41 $this->gender = $gender;
42 }
43
44 /**
45 * @return Gender
46 */
47 public function getGender()
48 {
49 return $this->gender;
50 }
51
52 /**
53 * @param Gender $gender
54 */
55 public function setGender(Gender $gender)
56 {
57 $this->gender = $gender;
58 }
59
60 /**
61 * Get the user type in a string form
62 */
63 public function getType()
64 {
65 return self::USER_ROLE_CUSTOMER;
66 }
67
68 /**
69 * @return StripeConnect
70 */
71 public function getStripeConnect()
72 {
73 return $this->stripeConnect;
74 }
75
76 /**
77 * @param StripeConnect $stripeConnect
78 */
79 public function setStripeConnect($stripeConnect)
80 {
81 $this->stripeConnect = $stripeConnect;
82 }
83
84
85 /**
86 * @return array
87 */
88 public function toArray()
89 {
90 return array_merge(
91 parent::toArray(),
92 [
93 'phone' => $this->getPhone()->getValue(),
94 'gender' => $this->getGender()->getValue(),
95 'stripeConnect' => $this->getStripeConnect() ? $this->getStripeConnect()->toArray() : null,
96 ]
97 );
98 }
99 }
100