Location.php
234 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\Entity\Location; |
| 4 | |
| 5 | use AmeliaBooking\Domain\ValueObjects\Json; |
| 6 | use AmeliaBooking\Domain\ValueObjects\String\Status; |
| 7 | use AmeliaBooking\Domain\ValueObjects\Picture; |
| 8 | use AmeliaBooking\Domain\ValueObjects\String\Address; |
| 9 | use AmeliaBooking\Domain\ValueObjects\String\Description; |
| 10 | use AmeliaBooking\Domain\ValueObjects\GeoTag; |
| 11 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 12 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 13 | use AmeliaBooking\Domain\ValueObjects\String\Phone; |
| 14 | use AmeliaBooking\Domain\ValueObjects\String\Url; |
| 15 | |
| 16 | /** |
| 17 | * Class Location |
| 18 | * |
| 19 | * @package AmeliaBooking\Domain\Entity\Location |
| 20 | */ |
| 21 | class Location |
| 22 | { |
| 23 | /** @var Id */ |
| 24 | private $id; |
| 25 | |
| 26 | /** @var Status */ |
| 27 | private $status; |
| 28 | |
| 29 | /** @var Name */ |
| 30 | private $name; |
| 31 | |
| 32 | /** @var Description */ |
| 33 | private $description; |
| 34 | |
| 35 | /** @var Address */ |
| 36 | private $address; |
| 37 | |
| 38 | /** @var Phone */ |
| 39 | private $phone; |
| 40 | |
| 41 | /** @var GeoTag */ |
| 42 | private $coordinates; |
| 43 | |
| 44 | /** @var Picture */ |
| 45 | private $picture; |
| 46 | |
| 47 | /** @var Url */ |
| 48 | private $pin; |
| 49 | |
| 50 | /** @var Json */ |
| 51 | protected $translations; |
| 52 | |
| 53 | /** |
| 54 | * @return Id |
| 55 | */ |
| 56 | public function getId() |
| 57 | { |
| 58 | return $this->id; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @param Id $id |
| 63 | */ |
| 64 | public function setId(Id $id) |
| 65 | { |
| 66 | $this->id = $id; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @return Status |
| 71 | */ |
| 72 | public function getStatus() |
| 73 | { |
| 74 | return $this->status; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @param Status $status |
| 79 | */ |
| 80 | public function setStatus(Status $status) |
| 81 | { |
| 82 | $this->status = $status; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @return Name |
| 87 | */ |
| 88 | public function getName() |
| 89 | { |
| 90 | return $this->name; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * @param Name $name |
| 95 | */ |
| 96 | public function setName(Name $name) |
| 97 | { |
| 98 | $this->name = $name; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @return Description |
| 103 | */ |
| 104 | public function getDescription() |
| 105 | { |
| 106 | return $this->description; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @param Description $description |
| 111 | */ |
| 112 | public function setDescription(Description $description) |
| 113 | { |
| 114 | $this->description = $description; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @return Address |
| 119 | */ |
| 120 | public function getAddress() |
| 121 | { |
| 122 | return $this->address; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * @param Address $address |
| 127 | */ |
| 128 | public function setAddress(Address $address) |
| 129 | { |
| 130 | $this->address = $address; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * @return Phone |
| 135 | */ |
| 136 | public function getPhone() |
| 137 | { |
| 138 | return $this->phone; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * @param Phone $phone |
| 143 | */ |
| 144 | public function setPhone(Phone $phone) |
| 145 | { |
| 146 | $this->phone = $phone; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * @return GeoTag |
| 151 | */ |
| 152 | public function getCoordinates() |
| 153 | { |
| 154 | return $this->coordinates; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * @param GeoTag $coordinates |
| 159 | */ |
| 160 | public function setCoordinates(GeoTag $coordinates) |
| 161 | { |
| 162 | $this->coordinates = $coordinates; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * @return Picture |
| 167 | */ |
| 168 | public function getPicture() |
| 169 | { |
| 170 | return $this->picture; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * @param Picture $picture |
| 175 | */ |
| 176 | public function setPicture(Picture $picture) |
| 177 | { |
| 178 | $this->picture = $picture; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * @return Url |
| 183 | */ |
| 184 | public function getPin() |
| 185 | { |
| 186 | return $this->pin; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * @param Url $pin |
| 191 | */ |
| 192 | public function setPin(Url $pin) |
| 193 | { |
| 194 | $this->pin = $pin; |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * @return Json |
| 199 | */ |
| 200 | public function getTranslations() |
| 201 | { |
| 202 | return $this->translations; |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * @param Json $translations |
| 207 | */ |
| 208 | public function setTranslations(Json $translations) |
| 209 | { |
| 210 | $this->translations = $translations; |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * @return array |
| 215 | */ |
| 216 | public function toArray() |
| 217 | { |
| 218 | return [ |
| 219 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 220 | 'status' => null !== $this->getStatus() ? $this->getStatus()->getValue() : null, |
| 221 | 'name' => $this->getName() ? $this->getName()->getValue() : '', |
| 222 | 'description' => null !== $this->getDescription() ? $this->getDescription()->getValue() : null, |
| 223 | 'address' => $this->getAddress() ? $this->getAddress()->getValue() : null, |
| 224 | 'phone' => $this->getPhone() ? $this->getPhone()->getValue() : null, |
| 225 | 'latitude' => $this->getCoordinates() ? $this->getCoordinates()->getLatitude() : null, |
| 226 | 'longitude' => $this->getCoordinates() ? $this->getCoordinates()->getLongitude() : null, |
| 227 | 'pictureFullPath' => null !== $this->getPicture() ? $this->getPicture()->getFullPath() : null, |
| 228 | 'pictureThumbPath' => null !== $this->getPicture() ? $this->getPicture()->getThumbPath() : null, |
| 229 | 'pin' => null !== $this->getPin() ? $this->getPin()->getValue() : null, |
| 230 | 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null, |
| 231 | ]; |
| 232 | } |
| 233 | } |
| 234 |