PluginProbe
Packeta / 2.1
Packeta v2.1
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
← All changes | src/Packetery/Core/Entity/Carrier.php +25 -20 1.6.1 → 2.1 View file →
@@ -17,9 +17,11 @@
17 17 class Carrier {
18 18
19 19 public const INTERNAL_PICKUP_POINTS_ID = 'packeta';
20 20 public const VENDOR_GROUP_ZPOINT = 'zpoint';
21 + public const VENDOR_GROUP_ZBOX = 'zbox';
21 22 public const ADDRESS_VALIDATION_COUNTRIES = [ 'cz', 'sk' ];
23 + public const CAR_DELIVERY_CARRIERS = [ '25061' ];
22 24
23 25 /**
24 26 * Carrier id.
25 27 *
@@ -111,8 +113,15 @@
111 113 */
112 114 private $maxWeight;
113 115
114 116 /**
117 + * Tells if carrier is available.
118 + *
119 + * @var bool
120 + */
121 + private $isAvailable;
122 +
123 + /**
115 124 * Carrier isDeleted.
116 125 *
117 126 * @var bool
118 127 */
@@ -124,27 +133,8 @@
124 133 * @var bool
125 134 */
126 135 private $ageVerification;
127 136
128 - /**
129 - * Carrier constructor.
130 - *
131 - * @param string $id Carrier id.
132 - * @param string $name Carrier name.
133 - * @param bool $hasPickupPoints Carrier hasPickupPoints.
134 - * @param bool $hasDirectLabel Carrier hasDirectLabel.
135 - * @param bool $requiresSeparateHouseNumber Carrier requiresSeparateHouseNumber.
136 - * @param bool $requiresCustomsDeclarations Carrier requiresCustomsDeclarations.
137 - * @param bool $requiresEmail Carrier requiresEmail.
138 - * @param bool $requiresPhone Carrier requiresPhone.
139 - * @param bool $requiresSize Carrier requiresSize.
140 - * @param bool $supportsCod Carrier supportsCod.
141 - * @param string $country Carrier country.
142 - * @param string $currency Carrier currency.
143 - * @param float $maxWeight Carrier maxWeight.
144 - * @param bool $isDeleted Carrier isDeleted.
145 - * @param bool $ageVerification Carrier supports age verification.
146 - */
147 137 public function __construct(
148 138 string $id,
149 139 string $name,
150 140 bool $hasPickupPoints,
@@ -157,8 +147,9 @@
157 147 bool $supportsCod,
158 148 string $country,
159 149 string $currency,
160 150 float $maxWeight,
151 + bool $isAvailable,
161 152 bool $isDeleted,
162 153 bool $ageVerification
163 154 ) {
164 155 $this->id = $id;
@@ -173,8 +164,9 @@
173 164 $this->supportsCod = $supportsCod;
174 165 $this->country = $country;
175 166 $this->currency = $currency;
176 167 $this->maxWeight = $maxWeight;
168 + $this->isAvailable = $isAvailable;
177 169 $this->isDeleted = $isDeleted;
178 170 $this->ageVerification = $ageVerification;
179 171 }
180 172
@@ -180,9 +172,9 @@
180 172
181 173 /**
182 174 * Returns all properties as array.
183 175 *
184 - * @return array
176 + * @return array<string, string|bool|float>
185 177 */
186 178 public function __toArray(): array {
187 179 return get_object_vars( $this );
188 180 }
@@ -303,8 +295,12 @@
303 295 public function getMaxWeight(): float {
304 296 return $this->maxWeight;
305 297 }
306 298
299 + public function isAvailable(): bool {
300 + return $this->isAvailable;
301 + }
302 +
307 303 /**
308 304 * Gets carrier isDeleted.
309 305 *
310 306 * @return bool
@@ -319,6 +315,15 @@
319 315 * @return bool
320 316 */
321 317 public function supportsAgeVerification(): bool {
322 318 return $this->ageVerification;
319 + }
320 +
321 + /**
322 + * Tells if is car delivery carrier.
323 + *
324 + * @return bool
325 + */
326 + public function isCarDelivery(): bool {
327 + return in_array( $this->id, self::CAR_DELIVERY_CARRIERS, true );
323 328 }
324 329 }