<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class DateRange implements \JsonSerializable { private $startDate; private $endDate; public function getStartDate(): ?string { return $this->startDate; } public function setStartDate(?string $startDate): void { $this->startDate = $startDate; } public function getEndDate(): ?string { return $this->endDate; } public function setEndDate(?string $endDate): void { $this->endDate = $endDate; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->startDate)) { $json['start_date'] = $this->startDate; } if (isset($this->endDate)) { $json['end_date'] = $this->endDate; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 