Tax.php
233 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 Collection */ |
| 43 | private $serviceList; |
| 44 | |
| 45 | /** @var Collection */ |
| 46 | private $eventList; |
| 47 | |
| 48 | /** @var Collection */ |
| 49 | private $packageList; |
| 50 | |
| 51 | /** @var Collection */ |
| 52 | private $extraList; |
| 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) |
| 66 | { |
| 67 | $this->id = $id; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * @return Name |
| 72 | */ |
| 73 | public function getName() |
| 74 | { |
| 75 | return $this->name; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @param Name $name |
| 80 | */ |
| 81 | public function setName(Name $name) |
| 82 | { |
| 83 | $this->name = $name; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @return FloatValue |
| 88 | */ |
| 89 | public function getAmount() |
| 90 | { |
| 91 | return $this->amount; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @param FloatValue $amount |
| 96 | */ |
| 97 | public function setAmount(FloatValue $amount) |
| 98 | { |
| 99 | $this->amount = $amount; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * @return AmountType |
| 104 | */ |
| 105 | public function getType() |
| 106 | { |
| 107 | return $this->type; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * @param AmountType $type |
| 112 | */ |
| 113 | public function setType(AmountType $type) |
| 114 | { |
| 115 | $this->type = $type; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * @return Status |
| 120 | */ |
| 121 | public function getStatus() |
| 122 | { |
| 123 | return $this->status; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * @param Status $status |
| 128 | */ |
| 129 | public function setStatus(Status $status) |
| 130 | { |
| 131 | $this->status = $status; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * @return BooleanValueObject |
| 136 | */ |
| 137 | public function getExcluded() |
| 138 | { |
| 139 | return $this->excluded; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * @param BooleanValueObject $excluded |
| 144 | */ |
| 145 | public function setExcluded(BooleanValueObject $excluded) |
| 146 | { |
| 147 | $this->excluded = $excluded; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * @return Collection |
| 152 | */ |
| 153 | public function getServiceList() |
| 154 | { |
| 155 | return $this->serviceList; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * @param Collection $serviceList |
| 160 | */ |
| 161 | public function setServiceList(Collection $serviceList) |
| 162 | { |
| 163 | $this->serviceList = $serviceList; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * @return Collection |
| 168 | */ |
| 169 | public function getEventList() |
| 170 | { |
| 171 | return $this->eventList; |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * @param Collection $eventList |
| 176 | */ |
| 177 | public function setEventList(Collection $eventList) |
| 178 | { |
| 179 | $this->eventList = $eventList; |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * @return Collection |
| 184 | */ |
| 185 | public function getPackageList() |
| 186 | { |
| 187 | return $this->packageList; |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * @param Collection $packageList |
| 192 | */ |
| 193 | public function setPackageList(Collection $packageList) |
| 194 | { |
| 195 | $this->packageList = $packageList; |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * @return Collection |
| 200 | */ |
| 201 | public function getExtraList() |
| 202 | { |
| 203 | return $this->extraList; |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * @param Collection $extraList |
| 208 | */ |
| 209 | public function setExtraList(Collection $extraList) |
| 210 | { |
| 211 | $this->extraList = $extraList; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * @return array |
| 216 | */ |
| 217 | public function toArray() |
| 218 | { |
| 219 | return [ |
| 220 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 221 | 'name' => $this->getName()->getValue(), |
| 222 | 'amount' => $this->getAmount()->getValue(), |
| 223 | 'type' => $this->getType()->getValue(), |
| 224 | 'status' => $this->getStatus()->getValue(), |
| 225 | 'excluded' => $this->getExcluded() ? $this->getExcluded()->getValue() : null, |
| 226 | 'serviceList' => $this->getServiceList() ? $this->getServiceList()->toArray() : [], |
| 227 | 'eventList' => $this->getEventList() ? $this->getEventList()->toArray() : [], |
| 228 | 'packageList' => $this->getPackageList() ? $this->getPackageList()->toArray() : [], |
| 229 | 'extraList' => $this->getExtraList() ? $this->getExtraList()->toArray() : [], |
| 230 | ]; |
| 231 | } |
| 232 | } |
| 233 |