Skip to content

Commit 7751bb0

Browse files
authored
Merge pull request #35 from DonSlon1/master
Přidání parametru size
2 parents ddec7de + d919ff9 commit 7751bb0

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

src/Model/PacketAttributes.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ final class PacketAttributes implements IModel
5252

5353
private ?string $customerBarcode;
5454

55+
private ?Size $size;
56+
5557

5658
public function __construct(
5759
string $number,
@@ -75,7 +77,8 @@ public function __construct(
7577
?string $carrierPickupPoint = null,
7678
?string $carrierService = null,
7779
?DispatchOrder $dispatchOrder = null,
78-
?string $customerBarcode = null
80+
?string $customerBarcode = null,
81+
?Size $size = null
7982
) {
8083
$this->setNumber($number);
8184
$this->setName($name);
@@ -99,6 +102,7 @@ public function __construct(
99102
$this->setCarrierService($carrierService);
100103
$this->setDispatchOrder($dispatchOrder);
101104
$this->setCustomerBarcode($customerBarcode);
105+
$this->setSize($size);
102106
}
103107

104108

@@ -372,6 +376,16 @@ public function setCustomerBarcode(?string $customerBarcode): void
372376
$this->customerBarcode = $customerBarcode;
373377
}
374378

379+
public function getSize() : ?Size
380+
{
381+
return $this->size;
382+
}
383+
384+
public function setSize(?Size $size) : void
385+
{
386+
$this->size = $size;
387+
}
388+
375389

376390
/**
377391
* @return mixed[]

src/Model/Size.php

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Salamek\Zasilkovna\Model;
6+
7+
final class Size implements IModel
8+
{
9+
private int $length;
10+
private int $width;
11+
private int $height;
12+
13+
public function __construct(
14+
int $length,
15+
int $width,
16+
int $height
17+
) {
18+
$this->setLength($length);
19+
$this->setWidth($width);
20+
$this->setHeight($height);
21+
}
22+
23+
public function getLength() : int
24+
{
25+
return $this->length;
26+
}
27+
28+
public function setLength(int $length) : void
29+
{
30+
$this->length = $length;
31+
}
32+
33+
public function getWidth() : int
34+
{
35+
return $this->width;
36+
}
37+
38+
public function setWidth(int $width) : void
39+
{
40+
$this->width = $width;
41+
}
42+
43+
public function getHeight() : int
44+
{
45+
return $this->height;
46+
}
47+
48+
public function setHeight(int $height) : void
49+
{
50+
$this->height = $height;
51+
}
52+
53+
54+
/**
55+
* @return mixed[]
56+
*/
57+
public function toArray(): array
58+
{
59+
return get_object_vars($this);
60+
}
61+
}

0 commit comments

Comments
 (0)