<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CatalogQuerySortedAttribute implements \JsonSerializable { private $attributeName; private $initialAttributeValue; private $sortOrder; public function __construct(string $attributeName) { $this->attributeName = $attributeName; } public function getAttributeName(): string { return $this->attributeName; } public function setAttributeName(string $attributeName): void { $this->attributeName = $attributeName; } public function getInitialAttributeValue(): ?string { return $this->initialAttributeValue; } public function setInitialAttributeValue(?string $initialAttributeValue): void { $this->initialAttributeValue = $initialAttributeValue; } public function getSortOrder(): ?string { return $this->sortOrder; } public function setSortOrder(?string $sortOrder): void { $this->sortOrder = $sortOrder; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['attribute_name'] = $this->attributeName; if (isset($this->initialAttributeValue)) { $json['initial_attribute_value'] = $this->initialAttributeValue; } if (isset($this->sortOrder)) { $json['sort_order'] = $this->sortOrder; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 