<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class StandardUnitDescription implements \JsonSerializable { private $unit; private $name; private $abbreviation; public function getUnit(): ?MeasurementUnit { return $this->unit; } public function setUnit(?MeasurementUnit $unit): void { $this->unit = $unit; } public function getName(): ?string { return $this->name; } public function setName(?string $name): void { $this->name = $name; } public function getAbbreviation(): ?string { return $this->abbreviation; } public function setAbbreviation(?string $abbreviation): void { $this->abbreviation = $abbreviation; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->unit)) { $json['unit'] = $this->unit; } if (isset($this->name)) { $json['name'] = $this->name; } if (isset($this->abbreviation)) { $json['abbreviation'] = $this->abbreviation; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 