/** * @param object $object * @return $this * @throws UnexpectedValueException */ public function fromObject($object) { parent::fromObject($object); if (property_exists($object, 'address')) { if (!is_object($object->address)) { throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); } $value = new AddressPersonal(); $this->address = $value->fromObject($object->address); } if (property_exists($object, 'companyInformation')) { if (!is_object($object->companyInformation)) { throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object'); } $value = new CompanyInformation(); $this->companyInformation = $value->fromObject($object->companyInformation); } if (property_exists($object, 'contactDetails')) { if (!is_object($object->contactDetails)) { throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); } $value = new ContactDetailsBase(); $this->contactDetails = $value->fromObject($object->contactDetails); } return $this; }
/** * @param object $object * @return $this * @throws UnexpectedValueException */ public function fromObject($object) { parent::fromObject($object); if (property_exists($object, 'billingAddress')) { if (!is_object($object->billingAddress)) { throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object'); } $value = new Address(); $this->billingAddress = $value->fromObject($object->billingAddress); } if (property_exists($object, 'locale')) { $this->locale = $object->locale; } if (property_exists($object, 'personalInformation')) { if (!is_object($object->personalInformation)) { throw new UnexpectedValueException('value \'' . print_r($object->personalInformation, true) . '\' is not an object'); } $value = new PersonalInformationRiskAssessment(); $this->personalInformation = $value->fromObject($object->personalInformation); } if (property_exists($object, 'shippingAddress')) { if (!is_object($object->shippingAddress)) { throw new UnexpectedValueException('value \'' . print_r($object->shippingAddress, true) . '\' is not an object'); } $value = new AddressPersonal(); $this->shippingAddress = $value->fromObject($object->shippingAddress); } return $this; }