From 4110b7f42e990d5e19205ee302298e81779aae8c Mon Sep 17 00:00:00 2001 From: DonSlon1 Date: Tue, 20 Aug 2024 12:05:39 +0200 Subject: [PATCH 1/2] feat: Add Size model with length, width, and height properties and toArray method --- src/Model/Size.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/Model/Size.php diff --git a/src/Model/Size.php b/src/Model/Size.php new file mode 100644 index 0000000..c1ebe88 --- /dev/null +++ b/src/Model/Size.php @@ -0,0 +1,61 @@ +setLength($length); + $this->setWidth($width); + $this->setHeight($height); + } + + public function getLength() : int + { + return $this->length; + } + + public function setLength(int $length) : void + { + $this->length = $length; + } + + public function getWidth() : int + { + return $this->width; + } + + public function setWidth(int $width) : void + { + $this->width = $width; + } + + public function getHeight() : int + { + return $this->height; + } + + public function setHeight(int $height) : void + { + $this->height = $height; + } + + + /** + * @return mixed[] + */ + public function toArray(): array + { + return get_object_vars($this); + } +} From d919ff95357efb03030a18026925196a91ce237f Mon Sep 17 00:00:00 2001 From: DonSlon1 Date: Tue, 20 Aug 2024 12:07:34 +0200 Subject: [PATCH 2/2] feat: Add size attribute to PacketAttributes model --- src/Model/PacketAttributes.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Model/PacketAttributes.php b/src/Model/PacketAttributes.php index a9d2c48..8ace643 100644 --- a/src/Model/PacketAttributes.php +++ b/src/Model/PacketAttributes.php @@ -52,6 +52,8 @@ final class PacketAttributes implements IModel private ?string $customerBarcode; + private ?Size $size; + public function __construct( string $number, @@ -75,7 +77,8 @@ public function __construct( ?string $carrierPickupPoint = null, ?string $carrierService = null, ?DispatchOrder $dispatchOrder = null, - ?string $customerBarcode = null + ?string $customerBarcode = null, + ?Size $size = null ) { $this->setNumber($number); $this->setName($name); @@ -99,6 +102,7 @@ public function __construct( $this->setCarrierService($carrierService); $this->setDispatchOrder($dispatchOrder); $this->setCustomerBarcode($customerBarcode); + $this->setSize($size); } @@ -372,6 +376,16 @@ public function setCustomerBarcode(?string $customerBarcode): void $this->customerBarcode = $customerBarcode; } + public function getSize() : ?Size + { + return $this->size; + } + + public function setSize(?Size $size) : void + { + $this->size = $size; + } + /** * @return mixed[]