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