Skip to content

Commit e47e752

Browse files
authored
Update ShipFrom.php
1 parent c0edff1 commit e47e752

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Entity/ShipFrom.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
class ShipFrom
66
{
77
private ?string $name;
8-
private ?string $attentionName;
8+
private string $attentionName = "";
99
private Phone $phone;
10-
private ?string $faxNumber;
10+
private string $faxNumber = "";
1111
private Address $address;
1212

13+
public function __construct()
14+
{
15+
$this->phone = new Phone();
16+
}
17+
1318
public function setName(string $name): self
1419
{
1520
$this->name = mb_substr($name, 0, 35);
@@ -60,7 +65,7 @@ public function setAddress(Address $address): self
6065
return $this;
6166
}
6267

63-
public function getAddress(): Address | null
68+
public function getAddress(): Address
6469
{
6570
return $this->address;
6671
}
@@ -76,7 +81,7 @@ public function toArray(): array
7681
$shipFrom["AttentionName"] = $this->attentionName;
7782
}
7883

79-
if ($this->phone) {
84+
if ($this->phone->exists()) {
8085
$shipFrom["Phone"] = $this->phone->toArray();
8186
}
8287

0 commit comments

Comments
 (0)