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