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