| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class PacketStatus |
| 4 |
* |
| 5 |
* @package Packetery\Api\Soap\Request |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types=1 ); |
| 9 |
|
| 10 |
namespace Packetery\Core\Api\Soap\Response; |
| 11 |
|
| 12 |
use Packetery\Core\CoreHelper; |
| 13 |
|
| 14 |
/** |
| 15 |
* Class PacketStatus |
| 16 |
* |
| 17 |
* @package Packetery\Api\Soap\Request |
| 18 |
*/ |
| 19 |
class PacketStatus extends BaseResponse { |
| 20 |
|
| 21 |
/** |
| 22 |
* Code text. |
| 23 |
* |
| 24 |
* @var string |
| 25 |
*/ |
| 26 |
private $codeText; |
| 27 |
|
| 28 |
/** |
| 29 |
* The last possible day to pick up the packet. |
| 30 |
* |
| 31 |
* @var \DateTimeImmutable|null |
| 32 |
*/ |
| 33 |
private $storedUntil; |
| 34 |
|
| 35 |
/** |
| 36 |
* Gets code text. |
| 37 |
* |
| 38 |
* @return string |
| 39 |
*/ |
| 40 |
public function getCodeText(): string { |
| 41 |
return $this->codeText; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Sets code text. |
| 46 |
* |
| 47 |
* @param string $codeText Code text. |
| 48 |
* |
| 49 |
* @return void |
| 50 |
*/ |
| 51 |
public function setCodeText( string $codeText ): void { |
| 52 |
$this->codeText = $codeText; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Gets stored until. |
| 57 |
* |
| 58 |
* @return \DateTimeImmutable|null |
| 59 |
*/ |
| 60 |
public function getStoredUntil(): ?\DateTimeImmutable { |
| 61 |
return $this->storedUntil; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Sets stored until. |
| 66 |
* |
| 67 |
* @param string|null $storedUntil Stored until. |
| 68 |
* |
| 69 |
* @return void |
| 70 |
*/ |
| 71 |
public function setStoredUntil( ?string $storedUntil ): void { |
| 72 |
if ( $storedUntil === null ) { |
| 73 |
$this->storedUntil = null; |
| 74 |
|
| 75 |
return; |
| 76 |
} |
| 77 |
|
| 78 |
$formattedStoredUntil = \DateTimeImmutable::createFromFormat( CoreHelper::MYSQL_DATE_FORMAT, $storedUntil ); |
| 79 |
$this->storedUntil = $formattedStoredUntil instanceof \DateTimeImmutable ? $formattedStoredUntil : null; |
| 80 |
} |
| 81 |
} |
| 82 |
|