1: <?php
2:
3: namespace ShippoClient\Http\Request\Shipments;
4:
5: use ShippoClient\Http\Request\Addresses\CreateObject as AddressCreate;
6: use ShippoClient\Http\Request\Parcels\CreateObject as ParcelCreate;
7:
8: class CreateObjectByNested extends CreateObject
9: {
10: public function getAddressFrom()
11: {
12: $addressFrom = $this->attributes->mustHave('address_from')->asArray();
13: $addressFromObj = new AddressCreate($addressFrom);
14:
15: return $addressFromObj->toArray();
16: }
17:
18: public function getAddressTo()
19: {
20: $addressTo = $this->attributes->mustHave('address_to')->asArray();
21: $addressToObj = new AddressCreate($addressTo);
22:
23: return $addressToObj->toArray();
24: }
25:
26: public function getParcel()
27: {
28: $parcel = $this->attributes->mustHave('parcel')->asArray();
29: $parcelObj = new ParcelCreate($parcel);
30:
31: return $parcelObj->toArray();
32: }
33: }
34: