<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class Money implements \JsonSerializable { private $amount; private $currency; public function getAmount(): ?int { return $this->amount; } public function setAmount(?int $amount): void { $this->amount = $amount; } public function getCurrency(): ?string { return $this->currency; } public function setCurrency(?string $currency): void { $this->currency = $currency; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->amount)) { $json['amount'] = $this->amount; } if (isset($this->currency)) { $json['currency'] = $this->currency; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 