1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class GetIINDetailsResponse extends DataObject
15: {
16: /**
17: * @var IINDetail[]|null
18: */
19: public ?array $coBrands = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $countryCode = null;
25:
26: /**
27: * @var bool|null
28: */
29: public ?bool $isAllowedInContext = null;
30:
31: /**
32: * @var int|null
33: */
34: public ?int $paymentProductId = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
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: * @param object $object
64: *
65: * @return $this
66: * @throws UnexpectedValueException
67: */
68: public function fromObject(object $object): GetIINDetailsResponse
69: {
70: parent::fromObject($object);
71: if (property_exists($object, 'coBrands')) {
72: if (!is_array($object->coBrands) && !is_object($object->coBrands)) {
73: throw new UnexpectedValueException('value \'' . print_r($object->coBrands, true) . '\' is not an array or object');
74: }
75: $this->coBrands = [];
76: foreach ($object->coBrands as $element) {
77: $value = new IINDetail();
78: $this->coBrands[] = $value->fromObject($element);
79: }
80: }
81: if (property_exists($object, 'countryCode')) {
82: $this->countryCode = $object->countryCode;
83: }
84: if (property_exists($object, 'isAllowedInContext')) {
85: $this->isAllowedInContext = $object->isAllowedInContext;
86: }
87: if (property_exists($object, 'paymentProductId')) {
88: $this->paymentProductId = $object->paymentProductId;
89: }
90: return $this;
91: }
92: }
93: