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 OnlinePinData extends DataObject
14: {
15: /**
16: * @var string|null
17: */
18: public ?string $encryptedPinBlock = null;
19:
20: /**
21: * @var int|null
22: */
23: public ?int $pinBlockFormat = null;
24:
25: /**
26: * @var PinEncryptionData|null
27: */
28: public ?PinEncryptionData $pinEncryptionData = null;
29:
30: /**
31: * @return object
32: */
33: public function toObject(): object
34: {
35: $object = parent::toObject();
36: if (!is_null($this->encryptedPinBlock)) {
37: $object->encryptedPinBlock = $this->encryptedPinBlock;
38: }
39: if (!is_null($this->pinBlockFormat)) {
40: $object->pinBlockFormat = $this->pinBlockFormat;
41: }
42: if (!is_null($this->pinEncryptionData)) {
43: $object->pinEncryptionData = $this->pinEncryptionData->toObject();
44: }
45: return $object;
46: }
47:
48: /**
49: * @param object $object
50: *
51: * @return $this
52: * @throws UnexpectedValueException
53: */
54: public function fromObject(object $object): OnlinePinData
55: {
56: parent::fromObject($object);
57: if (property_exists($object, 'encryptedPinBlock')) {
58: $this->encryptedPinBlock = $object->encryptedPinBlock;
59: }
60: if (property_exists($object, 'pinBlockFormat')) {
61: $this->pinBlockFormat = $object->pinBlockFormat;
62: }
63: if (property_exists($object, 'pinEncryptionData')) {
64: if (!is_object($object->pinEncryptionData)) {
65: throw new UnexpectedValueException('value \'' . print_r($object->pinEncryptionData, true) . '\' is not an object');
66: }
67: $value = new PinEncryptionData();
68: $this->pinEncryptionData = $value->fromObject($object->pinEncryptionData);
69: }
70: return $this;
71: }
72: }
73: