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 SessionResponse extends DataObject
15: {
16: /**
17: * @var string
18: */
19: public $assetUrl = null;
20:
21: /**
22: * @var string
23: */
24: public $clientApiUrl = null;
25:
26: /**
27: * @var string
28: */
29: public $clientSessionId = null;
30:
31: /**
32: * @var string
33: */
34: public $customerId = null;
35:
36: /**
37: * @var string[]
38: */
39: public $invalidTokens = null;
40:
41: /**
42: * @var string
43: */
44: public $region = null;
45:
46: /**
47: * @return object
48: */
49: public function toObject()
50: {
51: $object = parent::toObject();
52: if (!is_null($this->assetUrl)) {
53: $object->assetUrl = $this->assetUrl;
54: }
55: if (!is_null($this->clientApiUrl)) {
56: $object->clientApiUrl = $this->clientApiUrl;
57: }
58: if (!is_null($this->clientSessionId)) {
59: $object->clientSessionId = $this->clientSessionId;
60: }
61: if (!is_null($this->customerId)) {
62: $object->customerId = $this->customerId;
63: }
64: if (!is_null($this->invalidTokens)) {
65: $object->invalidTokens = [];
66: foreach ($this->invalidTokens as $element) {
67: if (!is_null($element)) {
68: $object->invalidTokens[] = $element;
69: }
70: }
71: }
72: if (!is_null($this->region)) {
73: $object->region = $this->region;
74: }
75: return $object;
76: }
77:
78: /**
79: * @param object $object
80: * @return $this
81: * @throws UnexpectedValueException
82: */
83: public function fromObject($object)
84: {
85: parent::fromObject($object);
86: if (property_exists($object, 'assetUrl')) {
87: $this->assetUrl = $object->assetUrl;
88: }
89: if (property_exists($object, 'clientApiUrl')) {
90: $this->clientApiUrl = $object->clientApiUrl;
91: }
92: if (property_exists($object, 'clientSessionId')) {
93: $this->clientSessionId = $object->clientSessionId;
94: }
95: if (property_exists($object, 'customerId')) {
96: $this->customerId = $object->customerId;
97: }
98: if (property_exists($object, 'invalidTokens')) {
99: if (!is_array($object->invalidTokens) && !is_object($object->invalidTokens)) {
100: throw new UnexpectedValueException('value \'' . print_r($object->invalidTokens, true) . '\' is not an array or object');
101: }
102: $this->invalidTokens = [];
103: foreach ($object->invalidTokens as $element) {
104: $this->invalidTokens[] = $element;
105: }
106: }
107: if (property_exists($object, 'region')) {
108: $this->region = $object->region;
109: }
110: return $this;
111: }
112: }
113: