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