<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class InvoiceQuery implements \JsonSerializable { private $filter; private $sort; public function __construct(InvoiceFilter $filter) { $this->filter = $filter; } public function getFilter(): InvoiceFilter { return $this->filter; } public function setFilter(InvoiceFilter $filter): void { $this->filter = $filter; } public function getSort(): ?InvoiceSort { return $this->sort; } public function setSort(?InvoiceSort $sort): void { $this->sort = $sort; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['filter'] = $this->filter; if (isset($this->sort)) { $json['sort'] = $this->sort; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 