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 PointOfSaleDataForResponse extends DataObject
14: {
15: /**
16: * @var EmvDataItem[]|null
17: */
18: public ?array $emvData = null;
19:
20: /**
21: * @var string|null
22: */
23: public ?string $panLast4Digits = null;
24:
25: /**
26: * @var int|null
27: */
28: public ?int $pinRetryCounter = null;
29:
30: /**
31: * @return object
32: */
33: public function toObject(): object
34: {
35: $object = parent::toObject();
36: if (!is_null($this->emvData)) {
37: $object->emvData = [];
38: foreach ($this->emvData as $element) {
39: if (!is_null($element)) {
40: $object->emvData[] = $element->toObject();
41: }
42: }
43: }
44: if (!is_null($this->panLast4Digits)) {
45: $object->panLast4Digits = $this->panLast4Digits;
46: }
47: if (!is_null($this->pinRetryCounter)) {
48: $object->pinRetryCounter = $this->pinRetryCounter;
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): PointOfSaleDataForResponse
60: {
61: parent::fromObject($object);
62: if (property_exists($object, 'emvData')) {
63: if (!is_array($object->emvData) && !is_object($object->emvData)) {
64: throw new UnexpectedValueException('value \'' . print_r($object->emvData, true) . '\' is not an array or object');
65: }
66: $this->emvData = [];
67: foreach ($object->emvData as $element) {
68: $value = new EmvDataItem();
69: $this->emvData[] = $value->fromObject($element);
70: }
71: }
72: if (property_exists($object, 'panLast4Digits')) {
73: $this->panLast4Digits = $object->panLast4Digits;
74: }
75: if (property_exists($object, 'pinRetryCounter')) {
76: $this->pinRetryCounter = $object->pinRetryCounter;
77: }
78: return $this;
79: }
80: }
81: