File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ public static function fromXML(string $xml){
1616 $ simpleXML = new SimpleXMLElement ($ xml );
1717
1818 $ channel = new static ;
19- $ channel ->order = Order::fromXML ($ simpleXML ->xpath ('order ' )[0 ]->asXML ());
19+ $ orderXML = $ simpleXML ->xpath ('order ' )[0 ] ?? null ;
20+ $ channel ->order = $ orderXML ?Order::fromXML ($ orderXML ->asXML ()):null ;
2021 return $ channel ;
2122 }
2223
Original file line number Diff line number Diff line change @@ -70,7 +70,8 @@ public static function fromXML(string $xml){
7070 $ order ->status_code = (string ) $ simpleXML ->xpath ('status_code ' )[0 ];
7171 $ order ->status_description = (string ) $ simpleXML ->xpath ('status_description ' )[0 ];
7272 $ order ->price = floatval ((string ) $ simpleXML ->xpath ('price ' )[0 ]);
73- $ order ->details = Details::fromXML ($ simpleXML ->xpath ('details ' )[0 ]->asXML ());
73+ $ detailsXML = $ simpleXML ->xpath ('details ' )[0 ] ?? null ;
74+ $ order ->details = $ detailsXML ?Details::fromXML ($ detailsXML ->asXML ()):null ;
7475 $ order ->order_complete = boolval ((string ) $ simpleXML ->xpath ('order_complete ' )[0 ]);
7576 $ order ->done = boolval ((string ) $ simpleXML ->xpath ('done ' )[0 ]);
7677 return $ order ;
You can’t perform that action at this time.
0 commit comments