1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class DeviceRenderOptions extends DataObject
15: {
16: /**
17: * @var string|null
18: */
19: public ?string $sdkInterface = null;
20:
21: /**
22: * @var string|null
23: *
24: * @deprecated Use deviceRenderOptions.sdkUiTypes instead
25: */
26: public ?string $sdkUiType = null;
27:
28: /**
29: * @var string[]|null
30: */
31: public ?array $sdkUiTypes = null;
32:
33: /**
34: * @return object
35: */
36: public function toObject(): object
37: {
38: $object = parent::toObject();
39: if (!is_null($this->sdkInterface)) {
40: $object->sdkInterface = $this->sdkInterface;
41: }
42: if (!is_null($this->sdkUiType)) {
43: $object->sdkUiType = $this->sdkUiType;
44: }
45: if (!is_null($this->sdkUiTypes)) {
46: $object->sdkUiTypes = [];
47: foreach ($this->sdkUiTypes as $element) {
48: if (!is_null($element)) {
49: $object->sdkUiTypes[] = $element;
50: }
51: }
52: }
53: return $object;
54: }
55:
56: /**
57: * @param object $object
58: *
59: * @return $this
60: * @throws UnexpectedValueException
61: */
62: public function fromObject(object $object): DeviceRenderOptions
63: {
64: parent::fromObject($object);
65: if (property_exists($object, 'sdkInterface')) {
66: $this->sdkInterface = $object->sdkInterface;
67: }
68: if (property_exists($object, 'sdkUiType')) {
69: $this->sdkUiType = $object->sdkUiType;
70: }
71: if (property_exists($object, 'sdkUiTypes')) {
72: if (!is_array($object->sdkUiTypes) && !is_object($object->sdkUiTypes)) {
73: throw new UnexpectedValueException('value \'' . print_r($object->sdkUiTypes, true) . '\' is not an array or object');
74: }
75: $this->sdkUiTypes = [];
76: foreach ($object->sdkUiTypes as $element) {
77: $this->sdkUiTypes[] = $element;
78: }
79: }
80: return $this;
81: }
82: }
83: