Tax.php
314 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\Tax; |
| 9 | |
| 10 | use AmeliaBooking\Domain\Collection\Collection; |
| 11 | use AmeliaBooking\Domain\ValueObjects\BooleanValueObject; |
| 12 | use AmeliaBooking\Domain\ValueObjects\Number\Float\FloatValue; |
| 13 | use AmeliaBooking\Domain\ValueObjects\String\AmountType; |
| 14 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 15 | use AmeliaBooking\Domain\ValueObjects\String\Status; |
| 16 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 17 | |
| 18 | /** |
| 19 | * Class Tax |
| 20 | * |
| 21 | * @package AmeliaBooking\Domain\Entity\Tax |
| 22 | */ |
| 23 | class Tax |
| 24 | { |
| 25 | /** @var Id */ |
| 26 | private $id; |
| 27 | |
| 28 | /** @var Name */ |
| 29 | private $name; |
| 30 | |
| 31 | /** @var FloatValue */ |
| 32 | private $amount; |
| 33 | |
| 34 | /** @var AmountType */ |
| 35 | private $type; |
| 36 | |
| 37 | /** @var Status */ |
| 38 | private $status; |
| 39 | |
| 40 | /** @var BooleanValueObject */ |
| 41 | private $excluded; |
| 42 | |
| 43 | /** @var BooleanValueObject */ |
| 44 | private $allServices; |
| 45 | |
| 46 | /** @var BooleanValueObject */ |
| 47 | private $allEvents; |
| 48 | |
| 49 | /** @var BooleanValueObject */ |
| 50 | private $allPackages; |
| 51 | |
| 52 | /** @var BooleanValueObject */ |
| 53 | private $allExtras; |
| 54 | |
| 55 | /** @var Collection */ |
| 56 | private $serviceList; |
| 57 | |
| 58 | /** @var Collection */ |
| 59 | private $eventList; |
| 60 | |
| 61 | /** @var Collection */ |
| 62 | private $packageList; |
| 63 | |
| 64 | /** @var Collection */ |
| 65 | private $extraList; |
| 66 | |
| 67 | /** |
| 68 | * @return Id |
| 69 | */ |
| 70 | public function getId() |
| 71 | { |
| 72 | return $this->id; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @param Id $id |
| 77 | */ |
| 78 | public function setId($id) |
| 79 | { |
| 80 | $this->id = $id; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @return Name |
| 85 | */ |
| 86 | public function getName() |
| 87 | { |
| 88 | return $this->name; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @param Name $name |
| 93 | */ |
| 94 | public function setName(Name $name) |
| 95 | { |
| 96 | $this->name = $name; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * @return FloatValue |
| 101 | */ |
| 102 | public function getAmount() |
| 103 | { |
| 104 | return $this->amount; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @param FloatValue $amount |
| 109 | */ |
| 110 | public function setAmount(FloatValue $amount) |
| 111 | { |
| 112 | $this->amount = $amount; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @return AmountType |
| 117 | */ |
| 118 | public function getType() |
| 119 | { |
| 120 | return $this->type; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * @param AmountType $type |
| 125 | */ |
| 126 | public function setType(AmountType $type) |
| 127 | { |
| 128 | $this->type = $type; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * @return Status |
| 133 | */ |
| 134 | public function getStatus() |
| 135 | { |
| 136 | return $this->status; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * @param Status $status |
| 141 | */ |
| 142 | public function setStatus(Status $status) |
| 143 | { |
| 144 | $this->status = $status; |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * @return BooleanValueObject |
| 149 | */ |
| 150 | public function getExcluded() |
| 151 | { |
| 152 | return $this->excluded; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @param BooleanValueObject $excluded |
| 157 | */ |
| 158 | public function setExcluded(BooleanValueObject $excluded) |
| 159 | { |
| 160 | $this->excluded = $excluded; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * @return BooleanValueObject |
| 165 | */ |
| 166 | public function getAllServices() |
| 167 | { |
| 168 | return $this->allServices; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * @param BooleanValueObject $allServices |
| 173 | */ |
| 174 | public function setAllServices(BooleanValueObject $allServices) |
| 175 | { |
| 176 | $this->allServices = $allServices; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * @return Collection |
| 181 | */ |
| 182 | public function getServiceList() |
| 183 | { |
| 184 | return $this->serviceList; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * @param Collection $serviceList |
| 189 | */ |
| 190 | public function setServiceList(Collection $serviceList) |
| 191 | { |
| 192 | $this->serviceList = $serviceList; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * @return BooleanValueObject |
| 197 | */ |
| 198 | public function getAllEvents() |
| 199 | { |
| 200 | return $this->allEvents; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * @param BooleanValueObject $allEvents |
| 205 | */ |
| 206 | public function setAllEvents(BooleanValueObject $allEvents) |
| 207 | { |
| 208 | $this->allEvents = $allEvents; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * @return Collection |
| 213 | */ |
| 214 | public function getEventList() |
| 215 | { |
| 216 | return $this->eventList; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * @param Collection $eventList |
| 221 | */ |
| 222 | public function setEventList(Collection $eventList) |
| 223 | { |
| 224 | $this->eventList = $eventList; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * @return BooleanValueObject |
| 229 | */ |
| 230 | public function getAllPackages() |
| 231 | { |
| 232 | return $this->allPackages; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * @param BooleanValueObject $allPackages |
| 237 | */ |
| 238 | public function setAllPackages(BooleanValueObject $allPackages) |
| 239 | { |
| 240 | $this->allPackages = $allPackages; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * @return Collection |
| 245 | */ |
| 246 | public function getPackageList() |
| 247 | { |
| 248 | return $this->packageList; |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * @param Collection $packageList |
| 253 | */ |
| 254 | public function setPackageList(Collection $packageList) |
| 255 | { |
| 256 | $this->packageList = $packageList; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * @return BooleanValueObject |
| 261 | */ |
| 262 | public function getAllExtras() |
| 263 | { |
| 264 | return $this->allExtras; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * @param BooleanValueObject $allExtras |
| 269 | */ |
| 270 | public function setAllExtras(BooleanValueObject $allExtras) |
| 271 | { |
| 272 | $this->allExtras = $allExtras; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * @return Collection |
| 277 | */ |
| 278 | public function getExtraList() |
| 279 | { |
| 280 | return $this->extraList; |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * @param Collection $extraList |
| 285 | */ |
| 286 | public function setExtraList(Collection $extraList) |
| 287 | { |
| 288 | $this->extraList = $extraList; |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * @return array |
| 293 | */ |
| 294 | public function toArray() |
| 295 | { |
| 296 | return [ |
| 297 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 298 | 'name' => $this->getName()->getValue(), |
| 299 | 'amount' => $this->getAmount()->getValue(), |
| 300 | 'type' => $this->getType()->getValue(), |
| 301 | 'status' => $this->getStatus()->getValue(), |
| 302 | 'excluded' => $this->getExcluded() ? $this->getExcluded()->getValue() : null, |
| 303 | 'allServices' => $this->getAllServices() ? $this->getAllServices()->getValue() : null, |
| 304 | 'allEvents' => $this->getAllEvents() ? $this->getAllEvents()->getValue() : null, |
| 305 | 'allPackages' => $this->getAllPackages() ? $this->getAllPackages()->getValue() : null, |
| 306 | 'allExtras' => $this->getAllExtras() ? $this->getAllExtras()->getValue() : null, |
| 307 | 'serviceList' => $this->getServiceList() ? $this->getServiceList()->toArray() : [], |
| 308 | 'eventList' => $this->getEventList() ? $this->getEventList()->toArray() : [], |
| 309 | 'packageList' => $this->getPackageList() ? $this->getPackageList()->toArray() : [], |
| 310 | 'extraList' => $this->getExtraList() ? $this->getExtraList()->toArray() : [], |
| 311 | ]; |
| 312 | } |
| 313 | } |
| 314 |