| 1: | <?php | 
| 2: |  | 
| 3: |  | 
| 4: |  | 
| 5: | namespace Worldline\Acquiring\Sdk\V1\Domain; | 
| 6: |  | 
| 7: | use UnexpectedValueException; | 
| 8: | use Worldline\Acquiring\Sdk\Domain\DataObject; | 
| 9: |  | 
| 10: |  | 
| 11: |  | 
| 12: |  | 
| 13: | class ServiceLocationData extends DataObject | 
| 14: | { | 
| 15: |  | 
| 16: |  | 
| 17: |  | 
| 18: | public $address = null; | 
| 19: |  | 
| 20: |  | 
| 21: |  | 
| 22: |  | 
| 23: | public $geoCoordinates = null; | 
| 24: |  | 
| 25: |  | 
| 26: |  | 
| 27: |  | 
| 28: | public function toObject() | 
| 29: | { | 
| 30: | $object = parent::toObject(); | 
| 31: | if (!is_null($this->address)) { | 
| 32: | $object->address = $this->address->toObject(); | 
| 33: | } | 
| 34: | if (!is_null($this->geoCoordinates)) { | 
| 35: | $object->geoCoordinates = $this->geoCoordinates->toObject(); | 
| 36: | } | 
| 37: | return $object; | 
| 38: | } | 
| 39: |  | 
| 40: |  | 
| 41: |  | 
| 42: |  | 
| 43: |  | 
| 44: |  | 
| 45: | public function fromObject($object) | 
| 46: | { | 
| 47: | parent::fromObject($object); | 
| 48: | if (property_exists($object, 'address')) { | 
| 49: | if (!is_object($object->address)) { | 
| 50: | throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); | 
| 51: | } | 
| 52: | $value = new ServiceLocationAddress(); | 
| 53: | $this->address = $value->fromObject($object->address); | 
| 54: | } | 
| 55: | if (property_exists($object, 'geoCoordinates')) { | 
| 56: | if (!is_object($object->geoCoordinates)) { | 
| 57: | throw new UnexpectedValueException('value \'' . print_r($object->geoCoordinates, true) . '\' is not an object'); | 
| 58: | } | 
| 59: | $value = new GeoCoordinates(); | 
| 60: | $this->geoCoordinates = $value->fromObject($object->geoCoordinates); | 
| 61: | } | 
| 62: | return $this; | 
| 63: | } | 
| 64: | } | 
| 65: |  |