1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use DateTime;
8: use UnexpectedValueException;
9: use Worldline\Acquiring\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Acquiring\Sdk\V1\Domain
13: */
14: class DateRange extends DataObject
15: {
16: /**
17: * @var DateTime|null
18: */
19: public ?DateTime $greaterEqual = null;
20:
21: /**
22: * @var DateTime|null
23: */
24: public ?DateTime $lowerEqual = null;
25:
26: /**
27: * @return object
28: */
29: public function toObject(): object
30: {
31: $object = parent::toObject();
32: if (!is_null($this->greaterEqual)) {
33: $object->greaterEqual = $this->greaterEqual->format('Y-m-d');
34: }
35: if (!is_null($this->lowerEqual)) {
36: $object->lowerEqual = $this->lowerEqual->format('Y-m-d');
37: }
38: return $object;
39: }
40:
41: /**
42: * @param object $object
43: *
44: * @return $this
45: * @throws UnexpectedValueException
46: */
47: public function fromObject(object $object): DateRange
48: {
49: parent::fromObject($object);
50: if (property_exists($object, 'greaterEqual')) {
51: $this->greaterEqual = new DateTime($object->greaterEqual);
52: }
53: if (property_exists($object, 'lowerEqual')) {
54: $this->lowerEqual = new DateTime($object->lowerEqual);
55: }
56: return $this;
57: }
58: }
59: