<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class CalculateOrderRequest implements \JsonSerializable { private $order; private $proposedRewards; public function __construct(Order $order) { $this->order = $order; } public function getOrder(): Order { return $this->order; } public function setOrder(Order $order): void { $this->order = $order; } public function getProposedRewards(): ?array { return $this->proposedRewards; } public function setProposedRewards(?array $proposedRewards): void { $this->proposedRewards = $proposedRewards; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['order'] = $this->order; if (isset($this->proposedRewards)) { $json['proposed_rewards'] = $this->proposedRewards; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 