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 CardOnFileData extends DataObject
14: {
15: /**
16: * @var InitialCardOnFileData|null
17: */
18: public ?InitialCardOnFileData $initialCardOnFileData = null;
19:
20: /**
21: * @var bool|null
22: */
23: public ?bool $isInitialTransaction = null;
24:
25: /**
26: * @var SubsequentCardOnFileData|null
27: */
28: public ?SubsequentCardOnFileData $subsequentCardOnFileData = null;
29:
30: /**
31: * @return object
32: */
33: public function toObject(): object
34: {
35: $object = parent::toObject();
36: if (!is_null($this->initialCardOnFileData)) {
37: $object->initialCardOnFileData = $this->initialCardOnFileData->toObject();
38: }
39: if (!is_null($this->isInitialTransaction)) {
40: $object->isInitialTransaction = $this->isInitialTransaction;
41: }
42: if (!is_null($this->subsequentCardOnFileData)) {
43: $object->subsequentCardOnFileData = $this->subsequentCardOnFileData->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): CardOnFileData
55: {
56: parent::fromObject($object);
57: if (property_exists($object, 'initialCardOnFileData')) {
58: if (!is_object($object->initialCardOnFileData)) {
59: throw new UnexpectedValueException('value \'' . print_r($object->initialCardOnFileData, true) . '\' is not an object');
60: }
61: $value = new InitialCardOnFileData();
62: $this->initialCardOnFileData = $value->fromObject($object->initialCardOnFileData);
63: }
64: if (property_exists($object, 'isInitialTransaction')) {
65: $this->isInitialTransaction = $object->isInitialTransaction;
66: }
67: if (property_exists($object, 'subsequentCardOnFileData')) {
68: if (!is_object($object->subsequentCardOnFileData)) {
69: throw new UnexpectedValueException('value \'' . print_r($object->subsequentCardOnFileData, true) . '\' is not an object');
70: }
71: $value = new SubsequentCardOnFileData();
72: $this->subsequentCardOnFileData = $value->fromObject($object->subsequentCardOnFileData);
73: }
74: return $this;
75: }
76: }
77: