<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CustomField implements \JsonSerializable { private $title; public function __construct(string $title) { $this->title = $title; } public function getTitle(): string { return $this->title; } public function setTitle(string $title): void { $this->title = $title; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['title'] = $this->title; $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 