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 GetCustomerDetailsRequest extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $countryCode = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $values = null; |
25: | |
26: | |
27: | |
28: | |
29: | public function toObject() |
30: | { |
31: | $object = parent::toObject(); |
32: | if (!is_null($this->countryCode)) { |
33: | $object->countryCode = $this->countryCode; |
34: | } |
35: | if (!is_null($this->values)) { |
36: | $object->values = []; |
37: | foreach ($this->values as $element) { |
38: | if (!is_null($element)) { |
39: | $object->values[] = $element->toObject(); |
40: | } |
41: | } |
42: | } |
43: | return $object; |
44: | } |
45: | |
46: | |
47: | |
48: | |
49: | |
50: | |
51: | public function fromObject($object) |
52: | { |
53: | parent::fromObject($object); |
54: | if (property_exists($object, 'countryCode')) { |
55: | $this->countryCode = $object->countryCode; |
56: | } |
57: | if (property_exists($object, 'values')) { |
58: | if (!is_array($object->values) && !is_object($object->values)) { |
59: | throw new UnexpectedValueException('value \'' . print_r($object->values, true) . '\' is not an array or object'); |
60: | } |
61: | $this->values = []; |
62: | foreach ($object->values as $element) { |
63: | $value = new KeyValuePair(); |
64: | $this->values[] = $value->fromObject($element); |
65: | } |
66: | } |
67: | return $this; |
68: | } |
69: | } |
70: | |