PluginProbe
Packeta / 1.4
Packeta v1.4
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
packeta / src / Packetery / Module / EntityFactory / Carrier.php

Carrier.php in Packeta 1.4, at src/Packetery/Module/EntityFactory/Carrier.php

75 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Carrier.
4 *
5 * @package Packetery\EntityFactory
6 */
7
8 declare( strict_types=1 );
9
10 namespace Packetery\Module\EntityFactory;
11
12 use Packetery\Core\Entity;
13
14 /**
15 * Class Carrier.
16 *
17 * @package Packetery\EntityFactory
18 */
19 class Carrier {
20
21 /**
22 * Carrier factory.
23 *
24 * @param array $dbResult Data from db.
25 *
26 * @return Entity\Carrier
27 */
28 public function fromDbResult( array $dbResult ): Entity\Carrier {
29 return new Entity\Carrier(
30 $dbResult['id'],
31 $dbResult['name'],
32 (bool) $dbResult['is_pickup_points'],
33 (bool) $dbResult['has_carrier_direct_label'],
34 (bool) $dbResult['separate_house_number'],
35 (bool) $dbResult['customs_declarations'],
36 (bool) $dbResult['requires_email'],
37 (bool) $dbResult['requires_phone'],
38 (bool) $dbResult['requires_size'],
39 ! (bool) $dbResult['disallows_cod'],
40 $dbResult['country'],
41 $dbResult['currency'],
42 (float) $dbResult['max_weight'],
43 (bool) $dbResult['deleted'],
44 false
45 );
46 }
47
48 /**
49 * Carrier factory.
50 *
51 * @param array $zpointCarrierData Data from db.
52 *
53 * @return Entity\Carrier
54 */
55 public function fromZpointCarrierData( array $zpointCarrierData ): Entity\Carrier {
56 return new Entity\Carrier(
57 (string) $zpointCarrierData['id'],
58 $zpointCarrierData['name'],
59 (bool) $zpointCarrierData['is_pickup_points'],
60 false,
61 false,
62 false,
63 false,
64 false,
65 false,
66 true,
67 $zpointCarrierData['country'],
68 $zpointCarrierData['currency'],
69 10,
70 false,
71 $zpointCarrierData['supports_age_verification']
72 );
73 }
74 }
75