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/Module/EntityFactory/Carrier.php +14 -2 1.6.12.1 View file →
@@ -19,15 +19,25 @@
19 19 */
20 20 class Carrier {
21 21
22 22 /**
23 + * An array of IDs of Carriers we want to add age verification check for
24 + */
25 + private const AGE_VERIFIED_CARRIERS = [
26 + '106',
27 + '131',
28 + ];
29 +
30 + /**
23 31 * Carrier factory.
24 32 *
25 - * @param array $dbResult Data from db.
33 + * @param array<string, string> $dbResult Data from db.
26 34 *
27 35 * @return Entity\Carrier
28 36 */
29 37 public function fromDbResult( array $dbResult ): Entity\Carrier {
38 + $ageVerified = in_array( $dbResult['id'], self::AGE_VERIFIED_CARRIERS, true );
39 +
30 40 return new Entity\Carrier(
31 41 $dbResult['id'],
32 42 $dbResult['name'],
33 43 (bool) $dbResult['is_pickup_points'],
@@ -40,10 +50,11 @@
40 50 ! (bool) $dbResult['disallows_cod'],
41 51 $dbResult['country'],
42 52 $dbResult['currency'],
43 53 (float) $dbResult['max_weight'],
54 + (bool) $dbResult['available'],
44 55 (bool) $dbResult['deleted'],
45 - false
56 + $ageVerified
46 57 );
47 58 }
48 59
49 60 /**
@@ -67,8 +78,9 @@
67 78 $nonFeedCarrierProvider->supportsCod(),
68 79 $nonFeedCarrierProvider->getCountry(),
69 80 $nonFeedCarrierProvider->getCurrency(),
70 81 10,
82 + true,
71 83 false,
72 84 $nonFeedCarrierProvider->supportsAgeVerification()
73 85 );
74 86 }