<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class TimeRange implements \JsonSerializable { private $startAt; private $endAt; public function getStartAt(): ?string { return $this->startAt; } public function setStartAt(?string $startAt): void { $this->startAt = $startAt; } public function getEndAt(): ?string { return $this->endAt; } public function setEndAt(?string $endAt): void { $this->endAt = $endAt; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->startAt)) { $json['start_at'] = $this->startAt; } if (isset($this->endAt)) { $json['end_at'] = $this->endAt; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 