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