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