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