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 PersonalInformation extends DataObject
15: {
16: /**
17: * @var string|null
18: */
19: public ?string $dateOfBirth = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $gender = null;
25:
26: /**
27: * @var PersonalIdentification|null
28: */
29: public ?PersonalIdentification $identification = null;
30:
31: /**
32: * @var PersonalName|null
33: */
34: public ?PersonalName $name = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
40: {
41: $object = parent::toObject();
42: if (!is_null($this->dateOfBirth)) {
43: $object->dateOfBirth = $this->dateOfBirth;
44: }
45: if (!is_null($this->gender)) {
46: $object->gender = $this->gender;
47: }
48: if (!is_null($this->identification)) {
49: $object->identification = $this->identification->toObject();
50: }
51: if (!is_null($this->name)) {
52: $object->name = $this->name->toObject();
53: }
54: return $object;
55: }
56:
57: /**
58: * @param object $object
59: *
60: * @return $this
61: * @throws UnexpectedValueException
62: */
63: public function fromObject(object $object): PersonalInformation
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'dateOfBirth')) {
67: $this->dateOfBirth = $object->dateOfBirth;
68: }
69: if (property_exists($object, 'gender')) {
70: $this->gender = $object->gender;
71: }
72: if (property_exists($object, 'identification')) {
73: if (!is_object($object->identification)) {
74: throw new UnexpectedValueException('value \'' . print_r($object->identification, true) . '\' is not an object');
75: }
76: $value = new PersonalIdentification();
77: $this->identification = $value->fromObject($object->identification);
78: }
79: if (property_exists($object, 'name')) {
80: if (!is_object($object->name)) {
81: throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object');
82: }
83: $value = new PersonalName();
84: $this->name = $value->fromObject($object->name);
85: }
86: return $this;
87: }
88: }
89: