| 1: | <?php |
| 2: | |
| 3: | |
| 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: | |
| 13: | |
| 14: | class DisputeDateTimeData extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public ?string $closedDateTime = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public ?string $lastStatusChangedDateTime = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public ?string $openedDateTime = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public ?DateTime $responseDueDate = null; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public function toObject(): object |
| 40: | { |
| 41: | $object = parent::toObject(); |
| 42: | if (!is_null($this->closedDateTime)) { |
| 43: | $object->closedDateTime = $this->closedDateTime; |
| 44: | } |
| 45: | if (!is_null($this->lastStatusChangedDateTime)) { |
| 46: | $object->lastStatusChangedDateTime = $this->lastStatusChangedDateTime; |
| 47: | } |
| 48: | if (!is_null($this->openedDateTime)) { |
| 49: | $object->openedDateTime = $this->openedDateTime; |
| 50: | } |
| 51: | if (!is_null($this->responseDueDate)) { |
| 52: | $object->responseDueDate = $this->responseDueDate->format('Y-m-d'); |
| 53: | } |
| 54: | return $object; |
| 55: | } |
| 56: | |
| 57: | |
| 58: | |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | public function fromObject(object $object): DisputeDateTimeData |
| 64: | { |
| 65: | parent::fromObject($object); |
| 66: | if (property_exists($object, 'closedDateTime')) { |
| 67: | $this->closedDateTime = $object->closedDateTime; |
| 68: | } |
| 69: | if (property_exists($object, 'lastStatusChangedDateTime')) { |
| 70: | $this->lastStatusChangedDateTime = $object->lastStatusChangedDateTime; |
| 71: | } |
| 72: | if (property_exists($object, 'openedDateTime')) { |
| 73: | $this->openedDateTime = $object->openedDateTime; |
| 74: | } |
| 75: | if (property_exists($object, 'responseDueDate')) { |
| 76: | $this->responseDueDate = new DateTime($object->responseDueDate); |
| 77: | } |
| 78: | return $this; |
| 79: | } |
| 80: | } |
| 81: | |