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 FindPayoutsResponse 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 PayoutResult[]
28: */
29: public $payouts = 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->payouts)) {
49: $object->payouts = [];
50: foreach ($this->payouts as $element) {
51: if (!is_null($element)) {
52: $object->payouts[] = $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, 'payouts')) {
77: if (!is_array($object->payouts) && !is_object($object->payouts)) {
78: throw new UnexpectedValueException('value \'' . print_r($object->payouts, true) . '\' is not an array or object');
79: }
80: $this->payouts = [];
81: foreach ($object->payouts as $element) {
82: $value = new PayoutResult();
83: $this->payouts[] = $value->fromObject($element);
84: }
85: }
86: if (property_exists($object, 'totalCount')) {
87: $this->totalCount = $object->totalCount;
88: }
89: return $this;
90: }
91: }
92: