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