PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
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 / Booking / Appointment / CustomerBookingExtra.php
ameliabooking / src / Domain / Entity / Booking / Appointment Last commit date
Appointment.php 1 year ago CustomerBooking.php 1 year ago CustomerBookingExtra.php 1 year ago
CustomerBookingExtra.php
184 lines
1 <?php
2 /**
3 * @copyright © TMS-Plugins. All rights reserved.
4 * @licence See LICENCE.md for license details.
5 */
6
7 namespace AmeliaBooking\Domain\Entity\Booking\Appointment;
8
9 use AmeliaBooking\Domain\ValueObjects\BooleanValueObject;
10 use AmeliaBooking\Domain\ValueObjects\Json;
11 use AmeliaBooking\Domain\ValueObjects\Number\Float\Price;
12 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
13 use AmeliaBooking\Domain\ValueObjects\Number\Integer\PositiveInteger;
14
15 /**
16 * Class CustomerBookingExtra
17 *
18 * @package AmeliaBooking\Domain\Entity\Booking\Appointment
19 */
20 class CustomerBookingExtra
21 {
22 /** @var Id */
23 private $id;
24
25 /** @var Id */
26 private $customerBookingId;
27
28 /** @var Id */
29 private $extraId;
30
31 /** @var PositiveInteger */
32 private $quantity;
33
34 /** @var Price */
35 protected $price;
36
37 /** @var BooleanValueObject */
38 protected $aggregatedPrice;
39
40 /** @var Json */
41 protected $tax;
42
43 /**
44 * CustomerBookingExtra constructor.
45 *
46 * @param Id $extraId
47 */
48 public function __construct(
49 Id $extraId
50 ) {
51 $this->extraId = $extraId;
52 }
53
54 /**
55 * @return Id
56 */
57 public function getId()
58 {
59 return $this->id;
60 }
61
62 /**
63 * @param Id $id
64 */
65 public function setId(Id $id)
66 {
67 $this->id = $id;
68 }
69
70 /**
71 * @return Id
72 */
73 public function getCustomerBookingId()
74 {
75 return $this->customerBookingId;
76 }
77
78 /**
79 * @param Id $customerBookingId
80 */
81 public function setCustomerBookingId(Id $customerBookingId)
82 {
83 $this->customerBookingId = $customerBookingId;
84 }
85
86 /**
87 * @return Id
88 */
89 public function getExtraId()
90 {
91 return $this->extraId;
92 }
93
94 /**
95 * @param Id $extraId
96 */
97 public function setExtraId(Id $extraId)
98 {
99 $this->extraId = $extraId;
100 }
101
102 /**
103 * @return PositiveInteger
104 */
105 public function getQuantity()
106 {
107 return $this->quantity;
108 }
109
110 /**
111 * @param PositiveInteger $quantity
112 */
113 public function setQuantity(PositiveInteger $quantity)
114 {
115 $this->quantity = $quantity;
116 }
117
118 /**
119 * @return Price
120 */
121 public function getPrice()
122 {
123 return $this->price;
124 }
125
126 /**
127 * @param Price $price
128 */
129 public function setPrice(Price $price)
130 {
131 $this->price = $price;
132 }
133
134 /**
135 * @return BooleanValueObject
136 */
137 public function getAggregatedPrice()
138 {
139 return $this->aggregatedPrice;
140 }
141
142 /**
143 * @param BooleanValueObject $aggregatedPrice
144 */
145 public function setAggregatedPrice(BooleanValueObject $aggregatedPrice)
146 {
147 $this->aggregatedPrice = $aggregatedPrice;
148 }
149
150 /**
151 * @return Json
152 */
153 public function getTax()
154 {
155 return $this->tax;
156 }
157
158 /**
159 * @param Json $tax
160 */
161 public function setTax(Json $tax)
162 {
163 $this->tax = $tax;
164 }
165
166 /**
167 * @return array
168 */
169 public function toArray()
170 {
171 return [
172 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
173 'customerBookingId' => $this->getCustomerBookingId() ? $this->getCustomerBookingId()->getValue() : null,
174 'extraId' => $this->getExtraId()->getValue(),
175 'quantity' => $this->getQuantity() ? $this->getQuantity()->getValue() : 1,
176 'price' => null !== $this->getPrice() ? $this->getPrice()->getValue() : null,
177 'aggregatedPrice' => $this->getAggregatedPrice() ? $this->getAggregatedPrice()->getValue() : null,
178 'tax' => null !== $this->getTax()
179 ? json_decode($this->getTax()->getValue(), true)
180 : null,
181 ];
182 }
183 }
184