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 / Booking / Appointment / CustomerBookingExtra.php
ameliabooking / src / Domain / Entity / Booking / Appointment Last commit date
Appointment.php 1 year ago CustomerBooking.php 2 years ago CustomerBookingExtra.php 2 years ago
CustomerBookingExtra.php
188 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 * @param PositiveInteger $quantity
48 */
49 public function __construct(
50 Id $extraId,
51 PositiveInteger $quantity
52 ) {
53 $this->extraId = $extraId;
54
55 $this->quantity = $quantity;
56 }
57
58 /**
59 * @return Id
60 */
61 public function getId()
62 {
63 return $this->id;
64 }
65
66 /**
67 * @param Id $id
68 */
69 public function setId(Id $id)
70 {
71 $this->id = $id;
72 }
73
74 /**
75 * @return Id
76 */
77 public function getCustomerBookingId()
78 {
79 return $this->customerBookingId;
80 }
81
82 /**
83 * @param Id $customerBookingId
84 */
85 public function setCustomerBookingId(Id $customerBookingId)
86 {
87 $this->customerBookingId = $customerBookingId;
88 }
89
90 /**
91 * @return Id
92 */
93 public function getExtraId()
94 {
95 return $this->extraId;
96 }
97
98 /**
99 * @param Id $extraId
100 */
101 public function setExtraId(Id $extraId)
102 {
103 $this->extraId = $extraId;
104 }
105
106 /**
107 * @return PositiveInteger
108 */
109 public function getQuantity()
110 {
111 return $this->quantity;
112 }
113
114 /**
115 * @param PositiveInteger $quantity
116 */
117 public function setQuantity(PositiveInteger $quantity)
118 {
119 $this->quantity = $quantity;
120 }
121
122 /**
123 * @return Price
124 */
125 public function getPrice()
126 {
127 return $this->price;
128 }
129
130 /**
131 * @param Price $price
132 */
133 public function setPrice(Price $price)
134 {
135 $this->price = $price;
136 }
137
138 /**
139 * @return BooleanValueObject
140 */
141 public function getAggregatedPrice()
142 {
143 return $this->aggregatedPrice;
144 }
145
146 /**
147 * @param BooleanValueObject $aggregatedPrice
148 */
149 public function setAggregatedPrice(BooleanValueObject $aggregatedPrice)
150 {
151 $this->aggregatedPrice = $aggregatedPrice;
152 }
153
154 /**
155 * @return Json
156 */
157 public function getTax()
158 {
159 return $this->tax;
160 }
161
162 /**
163 * @param Json $tax
164 */
165 public function setTax(Json $tax)
166 {
167 $this->tax = $tax;
168 }
169
170 /**
171 * @return array
172 */
173 public function toArray()
174 {
175 return [
176 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
177 'customerBookingId' => $this->getCustomerBookingId() ? $this->getCustomerBookingId()->getValue() : null,
178 'extraId' => $this->getExtraId()->getValue(),
179 'quantity' => $this->getQuantity() ? $this->getQuantity()->getValue() : 1,
180 'price' => null !== $this->getPrice() ? $this->getPrice()->getValue() : null,
181 'aggregatedPrice' => $this->getAggregatedPrice() ? $this->getAggregatedPrice()->getValue() : null,
182 'tax' => null !== $this->getTax()
183 ? json_decode($this->getTax()->getValue(), true)
184 : null,
185 ];
186 }
187 }
188