Service
6 months ago
AbstractBookable.php
2 months ago
AbstractCategory.php
6 months ago
AbstractExtra.php
1 year ago
AbstractCategory.php
207 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; |
| 9 | |
| 10 | use AmeliaBooking\Domain\Collection\Collection; |
| 11 | use AmeliaBooking\Domain\ValueObjects\Json; |
| 12 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 13 | use AmeliaBooking\Domain\ValueObjects\Picture; |
| 14 | use AmeliaBooking\Domain\ValueObjects\String\Color; |
| 15 | use AmeliaBooking\Domain\ValueObjects\String\Status; |
| 16 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\PositiveInteger; |
| 17 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 18 | |
| 19 | /** |
| 20 | * Class AbstractCategory |
| 21 | * |
| 22 | * @package AmeliaBooking\Domain\Entity\Bookable |
| 23 | */ |
| 24 | abstract class AbstractCategory |
| 25 | { |
| 26 | /** @var Id */ |
| 27 | private $id; |
| 28 | |
| 29 | /** @var Status */ |
| 30 | protected $status; |
| 31 | |
| 32 | /** @var Name */ |
| 33 | protected $name; |
| 34 | |
| 35 | /** @var Collection */ |
| 36 | private $serviceList; |
| 37 | |
| 38 | /** @var PositiveInteger */ |
| 39 | protected $position; |
| 40 | |
| 41 | /** @var Json */ |
| 42 | protected $translations; |
| 43 | |
| 44 | /** @var Color */ |
| 45 | protected $color; |
| 46 | |
| 47 | /** @var Picture */ |
| 48 | protected $picture; |
| 49 | |
| 50 | /** |
| 51 | * AbstractCategory constructor. |
| 52 | * |
| 53 | * @param Name $name |
| 54 | */ |
| 55 | public function __construct( |
| 56 | Name $name |
| 57 | ) { |
| 58 | $this->name = $name; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return Id |
| 63 | */ |
| 64 | public function getId() |
| 65 | { |
| 66 | return $this->id; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @param Id $id |
| 71 | */ |
| 72 | public function setId(Id $id) |
| 73 | { |
| 74 | $this->id = $id; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @return Status |
| 79 | */ |
| 80 | public function getStatus() |
| 81 | { |
| 82 | return $this->status; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @param Status $status |
| 87 | */ |
| 88 | public function setStatus(Status $status) |
| 89 | { |
| 90 | $this->status = $status; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * @return Name |
| 95 | */ |
| 96 | public function getName() |
| 97 | { |
| 98 | return $this->name; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @param Name $name |
| 103 | */ |
| 104 | public function setName(Name $name) |
| 105 | { |
| 106 | $this->name = $name; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @return Collection |
| 111 | */ |
| 112 | public function getServiceList() |
| 113 | { |
| 114 | return $this->serviceList; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @param Collection $serviceList |
| 119 | */ |
| 120 | public function setServiceList(Collection $serviceList) |
| 121 | { |
| 122 | $this->serviceList = $serviceList; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * @return PositiveInteger |
| 127 | */ |
| 128 | public function getPosition() |
| 129 | { |
| 130 | return $this->position; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * @param PositiveInteger $position |
| 135 | */ |
| 136 | public function setPosition($position) |
| 137 | { |
| 138 | $this->position = $position; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * @return Json |
| 143 | */ |
| 144 | public function getTranslations() |
| 145 | { |
| 146 | return $this->translations; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * @param Json $translations |
| 151 | */ |
| 152 | public function setTranslations(Json $translations) |
| 153 | { |
| 154 | $this->translations = $translations; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * @return Color |
| 159 | */ |
| 160 | public function getColor() |
| 161 | { |
| 162 | return $this->color; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * @param Color $color |
| 167 | */ |
| 168 | public function setColor(Color $color) |
| 169 | { |
| 170 | $this->color = $color; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * @return Picture |
| 175 | */ |
| 176 | public function getPicture() |
| 177 | { |
| 178 | return $this->picture; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * @param Picture $picture |
| 183 | */ |
| 184 | public function setPicture(Picture $picture) |
| 185 | { |
| 186 | $this->picture = $picture; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * @return array |
| 191 | */ |
| 192 | public function toArray() |
| 193 | { |
| 194 | return [ |
| 195 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 196 | 'status' => $this->getStatus() ? $this->getStatus()->getValue() : null, |
| 197 | 'name' => $this->getName()->getValue(), |
| 198 | 'serviceList' => $this->getServiceList() ? $this->getServiceList()->toArray() : [], |
| 199 | 'position' => $this->getPosition() ? $this->getPosition()->getValue() : null, |
| 200 | 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null, |
| 201 | 'color' => null !== $this->getColor() ? $this->getColor()->getValue() : null, |
| 202 | 'pictureFullPath' => null !== $this->getPicture() ? $this->getPicture()->getFullPath() : null, |
| 203 | 'pictureThumbPath' => null !== $this->getPicture() ? $this->getPicture()->getThumbPath() : null, |
| 204 | ]; |
| 205 | } |
| 206 | } |
| 207 |