<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class AdditionalRecipient implements \JsonSerializable { private $locationId; private $description; private $amountMoney; private $receivableId; public function __construct(string $locationId, Money $amountMoney) { $this->locationId = $locationId; $this->amountMoney = $amountMoney; } public function getLocationId(): string { return $this->locationId; } public function setLocationId(string $locationId): void { $this->locationId = $locationId; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): void { $this->description = $description; } public function getAmountMoney(): Money { return $this->amountMoney; } public function setAmountMoney(Money $amountMoney): void { $this->amountMoney = $amountMoney; } public function getReceivableId(): ?string { return $this->receivableId; } public function setReceivableId(?string $receivableId): void { $this->receivableId = $receivableId; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['location_id'] = $this->locationId; if (isset($this->description)) { $json['description'] = $this->description; } $json['amount_money'] = $this->amountMoney; if (isset($this->receivableId)) { $json['receivable_id'] = $this->receivableId; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 