Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Přidání parametru size #35

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Model/PacketAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ final class PacketAttributes implements IModel

private ?string $customerBarcode;

private ?Size $size;


public function __construct(
string $number,
Expand All @@ -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);
Expand All @@ -99,6 +102,7 @@ public function __construct(
$this->setCarrierService($carrierService);
$this->setDispatchOrder($dispatchOrder);
$this->setCustomerBarcode($customerBarcode);
$this->setSize($size);
}


Expand Down Expand Up @@ -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[]
Expand Down
61 changes: 61 additions & 0 deletions src/Model/Size.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

declare(strict_types=1);

namespace Salamek\Zasilkovna\Model;

final class Size implements IModel
{
private int $length;
private int $width;
private int $height;

public function __construct(
int $length,
int $width,
int $height
) {
$this->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);
}
}