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