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