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 OrderStatusOutput extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $errors = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $isCancellable = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $isRetriable = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $providerRawOutput = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $statusCategory = null; |
40: | |
41: | |
42: | |
43: | |
44: | public $statusCode = null; |
45: | |
46: | |
47: | |
48: | |
49: | public $statusCodeChangeDateTime = null; |
50: | |
51: | |
52: | |
53: | |
54: | public function toObject() |
55: | { |
56: | $object = parent::toObject(); |
57: | if (!is_null($this->errors)) { |
58: | $object->errors = []; |
59: | foreach ($this->errors as $element) { |
60: | if (!is_null($element)) { |
61: | $object->errors[] = $element->toObject(); |
62: | } |
63: | } |
64: | } |
65: | if (!is_null($this->isCancellable)) { |
66: | $object->isCancellable = $this->isCancellable; |
67: | } |
68: | if (!is_null($this->isRetriable)) { |
69: | $object->isRetriable = $this->isRetriable; |
70: | } |
71: | if (!is_null($this->providerRawOutput)) { |
72: | $object->providerRawOutput = []; |
73: | foreach ($this->providerRawOutput as $element) { |
74: | if (!is_null($element)) { |
75: | $object->providerRawOutput[] = $element->toObject(); |
76: | } |
77: | } |
78: | } |
79: | if (!is_null($this->statusCategory)) { |
80: | $object->statusCategory = $this->statusCategory; |
81: | } |
82: | if (!is_null($this->statusCode)) { |
83: | $object->statusCode = $this->statusCode; |
84: | } |
85: | if (!is_null($this->statusCodeChangeDateTime)) { |
86: | $object->statusCodeChangeDateTime = $this->statusCodeChangeDateTime; |
87: | } |
88: | return $object; |
89: | } |
90: | |
91: | |
92: | |
93: | |
94: | |
95: | |
96: | public function fromObject($object) |
97: | { |
98: | parent::fromObject($object); |
99: | if (property_exists($object, 'errors')) { |
100: | if (!is_array($object->errors) && !is_object($object->errors)) { |
101: | throw new UnexpectedValueException('value \'' . print_r($object->errors, true) . '\' is not an array or object'); |
102: | } |
103: | $this->errors = []; |
104: | foreach ($object->errors as $element) { |
105: | $value = new APIError(); |
106: | $this->errors[] = $value->fromObject($element); |
107: | } |
108: | } |
109: | if (property_exists($object, 'isCancellable')) { |
110: | $this->isCancellable = $object->isCancellable; |
111: | } |
112: | if (property_exists($object, 'isRetriable')) { |
113: | $this->isRetriable = $object->isRetriable; |
114: | } |
115: | if (property_exists($object, 'providerRawOutput')) { |
116: | if (!is_array($object->providerRawOutput) && !is_object($object->providerRawOutput)) { |
117: | throw new UnexpectedValueException('value \'' . print_r($object->providerRawOutput, true) . '\' is not an array or object'); |
118: | } |
119: | $this->providerRawOutput = []; |
120: | foreach ($object->providerRawOutput as $element) { |
121: | $value = new KeyValuePair(); |
122: | $this->providerRawOutput[] = $value->fromObject($element); |
123: | } |
124: | } |
125: | if (property_exists($object, 'statusCategory')) { |
126: | $this->statusCategory = $object->statusCategory; |
127: | } |
128: | if (property_exists($object, 'statusCode')) { |
129: | $this->statusCode = $object->statusCode; |
130: | } |
131: | if (property_exists($object, 'statusCodeChangeDateTime')) { |
132: | $this->statusCodeChangeDateTime = $object->statusCodeChangeDateTime; |
133: | } |
134: | return $this; |
135: | } |
136: | } |
137: | |