PluginProbe
Packeta / trunk
Packeta vtrunk
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 / Carrier / CarDeliveryConfig.php

CarDeliveryConfig.php in Packeta trunk, at src/Packetery/Module/Carrier/CarDeliveryConfig.php

84 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class CarDeliveryConfig
4 *
5 * @package Packetery
6 */
7
8 namespace Packetery\Module\Carrier;
9
10 use Packetery\Core\Entity\Carrier;
11
12 /**
13 * Class CarDeliveryConfig
14 *
15 * @package Packetery
16 */
17 class CarDeliveryConfig {
18
19 /**
20 * True if sample mode enabled.
21 *
22 * @var bool
23 */
24 private $sample;
25
26 /**
27 * True if enabled.
28 *
29 * @var bool
30 */
31 private $enabled;
32
33 /**
34 * CarDeliveryConfig constructor.
35 *
36 * @param bool $sample Sample.
37 * @param bool $enabled Enabled.
38 */
39 public function __construct( bool $sample, bool $enabled ) {
40 $this->sample = $sample;
41 $this->enabled = $enabled;
42 }
43
44 /**
45 * Tells whether the sample cars for Packeta CD are enabled, or not.
46 *
47 * @return bool
48 */
49 public function isSampleEnabled(): bool {
50 return $this->sample;
51 }
52
53 /**
54 * Tells whether the car delivery is disabled, or otherwise.
55 *
56 * @return bool
57 */
58 public function isDisabled(): bool {
59 return ! $this->enabled;
60 }
61
62 /**
63 * Checks if carrier is car delivery carrier.
64 *
65 * @param string $carrierId Carrier ID.
66 *
67 * @return bool
68 */
69 public function isCarDeliveryCarrier( string $carrierId ): bool {
70 return in_array( $carrierId, Carrier::CAR_DELIVERY_CARRIERS, true );
71 }
72
73 /**
74 * Checks if car delivery is disabled.
75 *
76 * @param string $carrierId Carrier ID.
77 *
78 * @return bool
79 */
80 public function isCarDeliveryCarrierDisabled( string $carrierId ): bool {
81 return $this->isCarDeliveryCarrier( $carrierId ) && $this->isDisabled();
82 }
83 }
84