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
Resource.php
175 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\ValueObjects\BooleanValueObject; |
| 11 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 12 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\PositiveInteger; |
| 13 | use AmeliaBooking\Domain\ValueObjects\String\EntityType; |
| 14 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 15 | use AmeliaBooking\Domain\ValueObjects\String\Status; |
| 16 | |
| 17 | /** |
| 18 | * Class Resource |
| 19 | * |
| 20 | * @package AmeliaBooking\Domain\Entity\Bookable\Service |
| 21 | */ |
| 22 | class Resource |
| 23 | { |
| 24 | /** @var Id */ |
| 25 | private $id; |
| 26 | |
| 27 | /** @var Name */ |
| 28 | private $name; |
| 29 | |
| 30 | /** @var PositiveInteger */ |
| 31 | private $quantity; |
| 32 | |
| 33 | /** @var EntityType */ |
| 34 | private $shared; |
| 35 | |
| 36 | /** @var Status */ |
| 37 | private $status; |
| 38 | |
| 39 | /** @var array */ |
| 40 | private $entities; |
| 41 | |
| 42 | /** @var BooleanValueObject */ |
| 43 | private $countAdditionalPeople; |
| 44 | |
| 45 | |
| 46 | /** |
| 47 | * @return Id |
| 48 | */ |
| 49 | public function getId() |
| 50 | { |
| 51 | return $this->id; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @param Id $id |
| 56 | */ |
| 57 | public function setId($id) |
| 58 | { |
| 59 | $this->id = $id; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @return Name |
| 64 | */ |
| 65 | public function getName() |
| 66 | { |
| 67 | return $this->name; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * @param Name $name |
| 72 | */ |
| 73 | public function setName($name) |
| 74 | { |
| 75 | $this->name = $name; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @return PositiveInteger |
| 80 | */ |
| 81 | public function getQuantity() |
| 82 | { |
| 83 | return $this->quantity; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @param PositiveInteger $quantity |
| 88 | */ |
| 89 | public function setQuantity($quantity) |
| 90 | { |
| 91 | $this->quantity = $quantity; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @return EntityType |
| 96 | */ |
| 97 | public function getShared() |
| 98 | { |
| 99 | return $this->shared; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * @param EntityType $shared |
| 104 | */ |
| 105 | public function setShared($shared) |
| 106 | { |
| 107 | $this->shared = $shared; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * @return Status |
| 112 | */ |
| 113 | public function getStatus() |
| 114 | { |
| 115 | return $this->status; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * @param Status $status |
| 120 | */ |
| 121 | public function setStatus($status) |
| 122 | { |
| 123 | $this->status = $status; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * @return array |
| 128 | */ |
| 129 | public function getEntities() |
| 130 | { |
| 131 | return $this->entities; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * @param array $entities |
| 136 | */ |
| 137 | public function setEntities($entities) |
| 138 | { |
| 139 | $this->entities = $entities; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * @return BooleanValueObject |
| 144 | */ |
| 145 | public function getCountAdditionalPeople() |
| 146 | { |
| 147 | return $this->countAdditionalPeople; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * @param BooleanValueObject $countAdditionalPeople |
| 152 | */ |
| 153 | public function setCountAdditionalPeople($countAdditionalPeople) |
| 154 | { |
| 155 | $this->countAdditionalPeople = $countAdditionalPeople; |
| 156 | } |
| 157 | |
| 158 | |
| 159 | /** |
| 160 | * @return array |
| 161 | */ |
| 162 | public function toArray() |
| 163 | { |
| 164 | return [ |
| 165 | 'id' => !empty($this->getId()) ? $this->getId()->getValue() : null, |
| 166 | 'name' => !empty($this->getName()) ? $this->getName()->getValue() : '', |
| 167 | 'quantity' => !empty($this->getQuantity()) ? $this->getQuantity()->getValue() : 1, |
| 168 | 'shared' => !empty($this->getShared()) ? $this->getShared()->getValue() : false, |
| 169 | 'status' => $this->getStatus() ? $this->getStatus()->getValue() : Status::VISIBLE, |
| 170 | 'entities' => $this->getEntities(), |
| 171 | 'countAdditionalPeople' => $this->getCountAdditionalPeople() ? $this->getCountAdditionalPeople()->getValue() : null |
| 172 | ]; |
| 173 | } |
| 174 | } |
| 175 |