1: | <?php |
2: | namespace Worldline\Acquiring\Sdk\Domain; |
3: | |
4: | use UnexpectedValueException; |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | class ShoppingCartExtension extends DataObject |
12: | { |
13: | |
14: | |
15: | |
16: | public $creator = null; |
17: | |
18: | |
19: | |
20: | |
21: | public $name = null; |
22: | |
23: | |
24: | |
25: | |
26: | public $version = null; |
27: | |
28: | |
29: | |
30: | |
31: | public $extensionId = null; |
32: | |
33: | |
34: | |
35: | |
36: | |
37: | |
38: | |
39: | public function __construct($creator, $name, $version, $extensionId = null) |
40: | { |
41: | $this->creator = $creator; |
42: | $this->name = $name; |
43: | $this->version = $version; |
44: | $this->extensionId = $extensionId; |
45: | } |
46: | |
47: | |
48: | |
49: | |
50: | public function toObject() |
51: | { |
52: | $object = parent::toObject(); |
53: | if (!is_null($this->creator)) { |
54: | $object->creator = $this->creator; |
55: | } |
56: | if (!is_null($this->name)) { |
57: | $object->name = $this->name; |
58: | } |
59: | if (!is_null($this->version)) { |
60: | $object->version = $this->version; |
61: | } |
62: | if (!is_null($this->extensionId)) { |
63: | $object->extensionId = $this->extensionId; |
64: | } |
65: | return $object; |
66: | } |
67: | |
68: | |
69: | |
70: | |
71: | |
72: | |
73: | public function fromObject($object) |
74: | { |
75: | parent::fromObject($object); |
76: | if (property_exists($object, 'creator')) { |
77: | $this->creator = $object->creator; |
78: | } |
79: | if (property_exists($object, 'name')) { |
80: | $this->name = $object->name; |
81: | } |
82: | if (property_exists($object, 'version')) { |
83: | $this->version = $object->version; |
84: | } |
85: | if (property_exists($object, 'extensionId')) { |
86: | $this->extensionId = $object->extensionId; |
87: | } |
88: | return $this; |
89: | } |
90: | } |
91: | |