<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class MeasurementUnit implements \JsonSerializable { private $customUnit; private $areaUnit; private $lengthUnit; private $volumeUnit; private $weightUnit; private $genericUnit; private $timeUnit; private $type; public function getCustomUnit(): ?MeasurementUnitCustom { return $this->customUnit; } public function setCustomUnit(?MeasurementUnitCustom $customUnit): void { $this->customUnit = $customUnit; } public function getAreaUnit(): ?string { return $this->areaUnit; } public function setAreaUnit(?string $areaUnit): void { $this->areaUnit = $areaUnit; } public function getLengthUnit(): ?string { return $this->lengthUnit; } public function setLengthUnit(?string $lengthUnit): void { $this->lengthUnit = $lengthUnit; } public function getVolumeUnit(): ?string { return $this->volumeUnit; } public function setVolumeUnit(?string $volumeUnit): void { $this->volumeUnit = $volumeUnit; } public function getWeightUnit(): ?string { return $this->weightUnit; } public function setWeightUnit(?string $weightUnit): void { $this->weightUnit = $weightUnit; } public function getGenericUnit(): ?string { return $this->genericUnit; } public function setGenericUnit(?string $genericUnit): void { $this->genericUnit = $genericUnit; } public function getTimeUnit(): ?string { return $this->timeUnit; } public function setTimeUnit(?string $timeUnit): void { $this->timeUnit = $timeUnit; } public function getType(): ?string { return $this->type; } public function setType(?string $type): void { $this->type = $type; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->customUnit)) { $json['custom_unit'] = $this->customUnit; } if (isset($this->areaUnit)) { $json['area_unit'] = $this->areaUnit; } if (isset($this->lengthUnit)) { $json['length_unit'] = $this->lengthUnit; } if (isset($this->volumeUnit)) { $json['volume_unit'] = $this->volumeUnit; } if (isset($this->weightUnit)) { $json['weight_unit'] = $this->weightUnit; } if (isset($this->genericUnit)) { $json['generic_unit'] = $this->genericUnit; } if (isset($this->timeUnit)) { $json['time_unit'] = $this->timeUnit; } if (isset($this->type)) { $json['type'] = $this->type; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 