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