| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class PacketStatus |
| 4 |
* |
| 5 |
* @package Packetery |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types=1 ); |
| 9 |
|
| 10 |
namespace Packetery\Core\Entity; |
| 11 |
|
| 12 |
/** |
| 13 |
* Class PacketStatus |
| 14 |
* |
| 15 |
* @package Packetery |
| 16 |
*/ |
| 17 |
class PacketStatus { |
| 18 |
|
| 19 |
public const DELIVERED = 'delivered'; |
| 20 |
public const POSTED_BACK = 'posted back'; |
| 21 |
public const ARRIVED = 'arrived'; |
| 22 |
public const READY_FOR_PICKUP = 'ready for pickup'; |
| 23 |
public const DEPARTED = 'departed'; |
| 24 |
public const CANCELLED = 'cancelled'; |
| 25 |
public const RECEIVED_DATA = 'received data'; |
| 26 |
public const COLLECTED = 'collected'; |
| 27 |
public const PREPARED_FOR_DEPARTURE = 'prepared for departure'; |
| 28 |
public const HANDED_TO_CARRIER = 'handed to carrier'; |
| 29 |
public const RETURNED = 'returned'; |
| 30 |
public const CUSTOMS = 'customs'; |
| 31 |
public const REVERSE_PACKET_ARRIVED = 'reverse packet arrived'; |
| 32 |
public const DELIVERY_ATTEMPT = 'delivery attempt'; |
| 33 |
public const REJECTED_BY_RECIPIENT = 'rejected by recipient'; |
| 34 |
public const UNKNOWN = 'unknown'; |
| 35 |
|
| 36 |
/** |
| 37 |
* Status name/code. |
| 38 |
* |
| 39 |
* @var string |
| 40 |
*/ |
| 41 |
private $name; |
| 42 |
|
| 43 |
/** |
| 44 |
* Translated name. |
| 45 |
* |
| 46 |
* @var string |
| 47 |
*/ |
| 48 |
private $translatedName; |
| 49 |
|
| 50 |
/** |
| 51 |
* Whether to synchronize packets with this state at default. |
| 52 |
* |
| 53 |
* @var bool |
| 54 |
*/ |
| 55 |
private $defaultSynchronization; |
| 56 |
|
| 57 |
/** |
| 58 |
* PacketStatus constructor. |
| 59 |
* |
| 60 |
* @param string $name Status name/code. |
| 61 |
* @param string $translatedName Translated name. |
| 62 |
* @param bool $defaultSynchronization Whether to synchronize packets with this state at default. |
| 63 |
*/ |
| 64 |
public function __construct( string $name, string $translatedName, bool $defaultSynchronization ) { |
| 65 |
$this->name = $name; |
| 66 |
$this->translatedName = $translatedName; |
| 67 |
$this->defaultSynchronization = $defaultSynchronization; |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Returns name. |
| 72 |
* |
| 73 |
* @return string |
| 74 |
*/ |
| 75 |
public function getName(): string { |
| 76 |
return $this->name; |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Returns translated name. |
| 81 |
* |
| 82 |
* @return string |
| 83 |
*/ |
| 84 |
public function getTranslatedName(): string { |
| 85 |
return $this->translatedName; |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* Returns whether it has default synchronization. |
| 90 |
* |
| 91 |
* @return bool |
| 92 |
*/ |
| 93 |
public function hasDefaultSynchronization(): bool { |
| 94 |
return $this->defaultSynchronization; |
| 95 |
} |
| 96 |
} |
| 97 |
|