Skip to content

Commit 8e609be

Browse files
authored
Update Shipper.php
1 parent be0a538 commit 8e609be

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Entity/Shipper.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
class Shipper
66
{
77
private ?string $name;
8-
private ?string $attentionName;
9-
private ?string $taxIdentificationNumber;
8+
private string $attentionName = "";
9+
private string $taxIdentificationNumber = "";
1010
private Phone $phone;
1111
private ?string $shipperNumber;
12-
private ?string $faxNumber;
12+
private string $faxNumber = "";
1313
private Address $address;
1414

15+
public function __construct()
16+
{
17+
$this->phone = new Phone();
18+
}
19+
1520
public function setName(string $name): self
1621
{
1722
$this->name = mb_substr($name, 0, 35);
@@ -84,7 +89,7 @@ public function setAddress(Address $address): self
8489
return $this;
8590
}
8691

87-
public function getAddress(): Address | null
92+
public function getAddress(): Address
8893
{
8994
return $this->address;
9095
}
@@ -105,7 +110,7 @@ public function toArray(): array
105110
$shipper["TaxIdentificationNumber"] = $this->taxIdentificationNumber;
106111
}
107112

108-
if ($this->phone) {
113+
if ($this->phone->exists()) {
109114
$shipper["Phone"] = $this->phone->toArray();
110115
}
111116

0 commit comments

Comments
 (0)