1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use UnexpectedValueException;
8: use Worldline\Acquiring\Sdk\Domain\DataObject;
9:
10: /**
11: * @package Worldline\Acquiring\Sdk\V1\Domain
12: */
13: class DisputeEntryResources extends DataObject
14: {
15: /**
16: * @var DisputeEntryWithDisputeSummary[]|null
17: */
18: public ?array $disputeEntries = null;
19:
20: /**
21: * @var PaginationResponse|null
22: */
23: public ?PaginationResponse $pagination = null;
24:
25: /**
26: * @var string|null
27: */
28: public ?string $requestId = null;
29:
30: /**
31: * @return object
32: */
33: public function toObject(): object
34: {
35: $object = parent::toObject();
36: if (!is_null($this->disputeEntries)) {
37: $object->disputeEntries = [];
38: foreach ($this->disputeEntries as $element) {
39: if (!is_null($element)) {
40: $object->disputeEntries[] = $element->toObject();
41: }
42: }
43: }
44: if (!is_null($this->pagination)) {
45: $object->pagination = $this->pagination->toObject();
46: }
47: if (!is_null($this->requestId)) {
48: $object->requestId = $this->requestId;
49: }
50: return $object;
51: }
52:
53: /**
54: * @param object $object
55: *
56: * @return $this
57: * @throws UnexpectedValueException
58: */
59: public function fromObject(object $object): DisputeEntryResources
60: {
61: parent::fromObject($object);
62: if (property_exists($object, 'disputeEntries')) {
63: if (!is_array($object->disputeEntries) && !is_object($object->disputeEntries)) {
64: throw new UnexpectedValueException('value \'' . print_r($object->disputeEntries, true) . '\' is not an array or object');
65: }
66: $this->disputeEntries = [];
67: foreach ($object->disputeEntries as $element) {
68: $value = new DisputeEntryWithDisputeSummary();
69: $this->disputeEntries[] = $value->fromObject($element);
70: }
71: }
72: if (property_exists($object, 'pagination')) {
73: if (!is_object($object->pagination)) {
74: throw new UnexpectedValueException('value \'' . print_r($object->pagination, true) . '\' is not an object');
75: }
76: $value = new PaginationResponse();
77: $this->pagination = $value->fromObject($object->pagination);
78: }
79: if (property_exists($object, 'requestId')) {
80: $this->requestId = $object->requestId;
81: }
82: return $this;
83: }
84: }
85: