File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 55class 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
You can’t perform that action at this time.
0 commit comments