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