Category.php
7 years ago
Extra.php
2 years ago
Package.php
2 years ago
PackageCustomer.php
2 years ago
PackageCustomerService.php
5 years ago
PackageService.php
2 years ago
Resource.php
2 years ago
Service.php
2 years ago
PackageService.php
214 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\Bookable\Service; |
| 8 | |
| 9 | use AmeliaBooking\Domain\Collection\Collection; |
| 10 | use AmeliaBooking\Domain\ValueObjects\BooleanValueObject; |
| 11 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 12 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\PositiveInteger; |
| 13 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\WholeNumber; |
| 14 | |
| 15 | /** |
| 16 | * Class PackageService |
| 17 | * |
| 18 | * @package AmeliaBooking\Domain\Entity\Bookable\Service |
| 19 | */ |
| 20 | class PackageService |
| 21 | { |
| 22 | /** @var Id */ |
| 23 | private $id; |
| 24 | |
| 25 | /** @var Service */ |
| 26 | protected $service; |
| 27 | |
| 28 | /** @var PositiveInteger */ |
| 29 | protected $quantity; |
| 30 | |
| 31 | /** @var WholeNumber */ |
| 32 | protected $minimumScheduled; |
| 33 | |
| 34 | /** @var WholeNumber */ |
| 35 | protected $maximumScheduled; |
| 36 | |
| 37 | /** @var Collection */ |
| 38 | private $providers; |
| 39 | |
| 40 | /** @var Collection */ |
| 41 | private $locations; |
| 42 | |
| 43 | /** @var BooleanValueObject */ |
| 44 | private $allowProviderSelection; |
| 45 | |
| 46 | /** @var PositiveInteger */ |
| 47 | protected $position; |
| 48 | |
| 49 | /** |
| 50 | * @return Id |
| 51 | */ |
| 52 | public function getId() |
| 53 | { |
| 54 | return $this->id; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @param Id $id |
| 59 | */ |
| 60 | public function setId(Id $id) |
| 61 | { |
| 62 | $this->id = $id; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * @return Service |
| 67 | */ |
| 68 | public function getService() |
| 69 | { |
| 70 | return $this->service; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @param Service $service |
| 75 | */ |
| 76 | public function setService(Service $service) |
| 77 | { |
| 78 | $this->service = $service; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @return PositiveInteger |
| 83 | */ |
| 84 | public function getQuantity() |
| 85 | { |
| 86 | return $this->quantity; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * @param PositiveInteger $quantity |
| 91 | */ |
| 92 | public function setQuantity(PositiveInteger $quantity) |
| 93 | { |
| 94 | $this->quantity = $quantity; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * @return WholeNumber |
| 99 | */ |
| 100 | public function getMinimumScheduled() |
| 101 | { |
| 102 | return $this->minimumScheduled; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * @param WholeNumber $minimumScheduled |
| 107 | */ |
| 108 | public function setMinimumScheduled(WholeNumber $minimumScheduled) |
| 109 | { |
| 110 | $this->minimumScheduled = $minimumScheduled; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * @return WholeNumber |
| 115 | */ |
| 116 | public function getMaximumScheduled() |
| 117 | { |
| 118 | return $this->maximumScheduled; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * @param WholeNumber $maximumScheduled |
| 123 | */ |
| 124 | public function setMaximumScheduled(WholeNumber $maximumScheduled) |
| 125 | { |
| 126 | $this->maximumScheduled = $maximumScheduled; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * @return Collection |
| 131 | */ |
| 132 | public function getProviders() |
| 133 | { |
| 134 | return $this->providers; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * @param Collection $providers |
| 139 | */ |
| 140 | public function setProviders(Collection $providers) |
| 141 | { |
| 142 | $this->providers = $providers; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * @return Collection |
| 147 | */ |
| 148 | public function getLocations() |
| 149 | { |
| 150 | return $this->locations; |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * @param Collection $locations |
| 155 | */ |
| 156 | public function setLocations(Collection $locations) |
| 157 | { |
| 158 | $this->locations = $locations; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * @return BooleanValueObject |
| 163 | */ |
| 164 | public function getAllowProviderSelection() |
| 165 | { |
| 166 | return $this->allowProviderSelection; |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * @param BooleanValueObject $allowProviderSelection |
| 171 | */ |
| 172 | public function setAllowProviderSelection($allowProviderSelection) |
| 173 | { |
| 174 | $this->allowProviderSelection = $allowProviderSelection; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * @return PositiveInteger |
| 179 | */ |
| 180 | public function getPosition() |
| 181 | { |
| 182 | return $this->position; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * @param PositiveInteger $position |
| 187 | */ |
| 188 | public function setPosition($position) |
| 189 | { |
| 190 | $this->position = $position; |
| 191 | } |
| 192 | |
| 193 | |
| 194 | /** |
| 195 | * @return array |
| 196 | */ |
| 197 | public function toArray() |
| 198 | { |
| 199 | return array_merge( |
| 200 | [ |
| 201 | 'id' => $this->getId() ? $this->getId()->getValue() : null, |
| 202 | 'quantity' => $this->getQuantity() ? $this->getQuantity()->getValue() : null, |
| 203 | 'service' => $this->getService() ? $this->getService()->toArray() : null, |
| 204 | 'minimumScheduled' => $this->getMinimumScheduled() ? $this->getMinimumScheduled()->getValue() : null, |
| 205 | 'maximumScheduled' => $this->getMaximumScheduled() ? $this->getMaximumScheduled()->getValue() : null, |
| 206 | 'providers' => $this->getProviders() ? $this->getProviders()->toArray() : [], |
| 207 | 'locations' => $this->getLocations() ? $this->getLocations()->toArray() : [], |
| 208 | 'allowProviderSelection' => $this->getAllowProviderSelection() ? $this->getAllowProviderSelection()->getValue() : null, |
| 209 | 'position' => null !== $this->getPosition() ? $this->getPosition()->getValue() : null, |
| 210 | ] |
| 211 | ); |
| 212 | } |
| 213 | } |
| 214 |