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