| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class PickupPoint |
| 4 |
* |
| 5 |
* @package Packetery\Entity |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Packetery\Core\Entity; |
| 9 |
|
| 10 |
/** |
| 11 |
* Class PickupPoint |
| 12 |
* |
| 13 |
* @package Packetery\Entity |
| 14 |
*/ |
| 15 |
class PickupPoint { |
| 16 |
|
| 17 |
/** |
| 18 |
* Selected pickup point ID |
| 19 |
* |
| 20 |
* @var string|null |
| 21 |
*/ |
| 22 |
private $id; |
| 23 |
|
| 24 |
/** |
| 25 |
* Point name. |
| 26 |
* |
| 27 |
* @var string|null |
| 28 |
*/ |
| 29 |
private $name; |
| 30 |
|
| 31 |
/** |
| 32 |
* Link to official Packeta detail page. |
| 33 |
* |
| 34 |
* @var string|null |
| 35 |
*/ |
| 36 |
private $url; |
| 37 |
|
| 38 |
/** |
| 39 |
* Pickup point street. |
| 40 |
* |
| 41 |
* @var string|null |
| 42 |
*/ |
| 43 |
private $street; |
| 44 |
|
| 45 |
/** |
| 46 |
* Pickup point zip. |
| 47 |
* |
| 48 |
* @var string|null |
| 49 |
*/ |
| 50 |
private $zip; |
| 51 |
|
| 52 |
/** |
| 53 |
* Pickup point city. |
| 54 |
* |
| 55 |
* @var string|null |
| 56 |
*/ |
| 57 |
private $city; |
| 58 |
|
| 59 |
/** |
| 60 |
* PickupPoint constructor. |
| 61 |
* |
| 62 |
* @param string|null $id Point id. |
| 63 |
* @param string|null $name Point name. |
| 64 |
* @param string|null $city Point city. |
| 65 |
* @param string|null $zip Point zip. |
| 66 |
* @param string|null $street Point street. |
| 67 |
* @param string|null $url Point url. |
| 68 |
*/ |
| 69 |
public function __construct( |
| 70 |
?string $id = null, |
| 71 |
?string $name = null, |
| 72 |
?string $city = null, |
| 73 |
?string $zip = null, |
| 74 |
?string $street = null, |
| 75 |
?string $url = null |
| 76 |
) { |
| 77 |
$this->id = $id; |
| 78 |
$this->name = $name; |
| 79 |
$this->city = $city; |
| 80 |
$this->zip = $zip; |
| 81 |
$this->street = $street; |
| 82 |
$this->url = $url; |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Selected pickup point ID |
| 87 |
* |
| 88 |
* @return string|null |
| 89 |
*/ |
| 90 |
public function getId(): ?string { |
| 91 |
return $this->id; |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* Point name. |
| 96 |
* |
| 97 |
* @return string|null |
| 98 |
*/ |
| 99 |
public function getName(): ?string { |
| 100 |
return $this->name; |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* Link to official Packeta detail page. |
| 105 |
* |
| 106 |
* @return string|null |
| 107 |
*/ |
| 108 |
public function getUrl(): ?string { |
| 109 |
return $this->url; |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* Gets pickup point street. |
| 114 |
* |
| 115 |
* @return string|null |
| 116 |
*/ |
| 117 |
public function getStreet(): ?string { |
| 118 |
return $this->street; |
| 119 |
} |
| 120 |
|
| 121 |
/** |
| 122 |
* Gets pickup point ZIP. |
| 123 |
* |
| 124 |
* @return string|null |
| 125 |
*/ |
| 126 |
public function getZip(): ?string { |
| 127 |
return $this->zip; |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* Gets pickup point city. |
| 132 |
* |
| 133 |
* @return string|null |
| 134 |
*/ |
| 135 |
public function getCity(): ?string { |
| 136 |
return $this->city; |
| 137 |
} |
| 138 |
|
| 139 |
/** |
| 140 |
* Gets full address. |
| 141 |
* |
| 142 |
* @return string |
| 143 |
*/ |
| 144 |
public function getFullAddress(): string { |
| 145 |
$afterCommaSection = implode( |
| 146 |
' ', |
| 147 |
array_filter( |
| 148 |
[ |
| 149 |
$this->city, |
| 150 |
$this->zip, |
| 151 |
] |
| 152 |
) |
| 153 |
); |
| 154 |
|
| 155 |
return implode( |
| 156 |
', ', |
| 157 |
array_filter( |
| 158 |
[ |
| 159 |
$this->street, |
| 160 |
$afterCommaSection, |
| 161 |
] |
| 162 |
) |
| 163 |
); |
| 164 |
} |
| 165 |
|
| 166 |
/** |
| 167 |
* Sets id. |
| 168 |
* |
| 169 |
* @param string|null $id Id. |
| 170 |
* |
| 171 |
* @return void |
| 172 |
*/ |
| 173 |
public function setId( ?string $id ): void { |
| 174 |
$this->id = $id; |
| 175 |
} |
| 176 |
|
| 177 |
/** |
| 178 |
* Sets name. |
| 179 |
* |
| 180 |
* @param string|null $name Name. |
| 181 |
* |
| 182 |
* @return void |
| 183 |
*/ |
| 184 |
public function setName( ?string $name ): void { |
| 185 |
$this->name = $name; |
| 186 |
} |
| 187 |
|
| 188 |
/** |
| 189 |
* Sets URL. |
| 190 |
* |
| 191 |
* @param string|null $url URL. |
| 192 |
* |
| 193 |
* @return void |
| 194 |
*/ |
| 195 |
public function setUrl( ?string $url ): void { |
| 196 |
$this->url = $url; |
| 197 |
} |
| 198 |
|
| 199 |
/** |
| 200 |
* Sets street. |
| 201 |
* |
| 202 |
* @param string|null $street Street. |
| 203 |
* |
| 204 |
* @return void |
| 205 |
*/ |
| 206 |
public function setStreet( ?string $street ): void { |
| 207 |
$this->street = $street; |
| 208 |
} |
| 209 |
|
| 210 |
/** |
| 211 |
* Sets ZIP. |
| 212 |
* |
| 213 |
* @param string|null $zip ZIP. |
| 214 |
* |
| 215 |
* @return void |
| 216 |
*/ |
| 217 |
public function setZip( ?string $zip ): void { |
| 218 |
$this->zip = $zip; |
| 219 |
} |
| 220 |
|
| 221 |
/** |
| 222 |
* Sets city. |
| 223 |
* |
| 224 |
* @param string|null $city City. |
| 225 |
* |
| 226 |
* @return void |
| 227 |
*/ |
| 228 |
public function setCity( ?string $city ): void { |
| 229 |
$this->city = $city; |
| 230 |
} |
| 231 |
} |
| 232 |
|