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