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