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 PaymentProductField extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $dataRestrictions = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $displayHints = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $id = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $type = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $usedForLookup = null; |
40: | |
41: | |
42: | |
43: | |
44: | public function toObject() |
45: | { |
46: | $object = parent::toObject(); |
47: | if (!is_null($this->dataRestrictions)) { |
48: | $object->dataRestrictions = $this->dataRestrictions->toObject(); |
49: | } |
50: | if (!is_null($this->displayHints)) { |
51: | $object->displayHints = $this->displayHints->toObject(); |
52: | } |
53: | if (!is_null($this->id)) { |
54: | $object->id = $this->id; |
55: | } |
56: | if (!is_null($this->type)) { |
57: | $object->type = $this->type; |
58: | } |
59: | if (!is_null($this->usedForLookup)) { |
60: | $object->usedForLookup = $this->usedForLookup; |
61: | } |
62: | return $object; |
63: | } |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | |
70: | public function fromObject($object) |
71: | { |
72: | parent::fromObject($object); |
73: | if (property_exists($object, 'dataRestrictions')) { |
74: | if (!is_object($object->dataRestrictions)) { |
75: | throw new UnexpectedValueException('value \'' . print_r($object->dataRestrictions, true) . '\' is not an object'); |
76: | } |
77: | $value = new PaymentProductFieldDataRestrictions(); |
78: | $this->dataRestrictions = $value->fromObject($object->dataRestrictions); |
79: | } |
80: | if (property_exists($object, 'displayHints')) { |
81: | if (!is_object($object->displayHints)) { |
82: | throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object'); |
83: | } |
84: | $value = new PaymentProductFieldDisplayHints(); |
85: | $this->displayHints = $value->fromObject($object->displayHints); |
86: | } |
87: | if (property_exists($object, 'id')) { |
88: | $this->id = $object->id; |
89: | } |
90: | if (property_exists($object, 'type')) { |
91: | $this->type = $object->type; |
92: | } |
93: | if (property_exists($object, 'usedForLookup')) { |
94: | $this->usedForLookup = $object->usedForLookup; |
95: | } |
96: | return $this; |
97: | } |
98: | } |
99: | |