<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class TipSettings implements \JsonSerializable { private $allowTipping; private $separateTipScreen; private $customTipField; private $tipPercentages; private $smartTipping; public function getAllowTipping(): ?bool { return $this->allowTipping; } public function setAllowTipping(?bool $allowTipping): void { $this->allowTipping = $allowTipping; } public function getSeparateTipScreen(): ?bool { return $this->separateTipScreen; } public function setSeparateTipScreen(?bool $separateTipScreen): void { $this->separateTipScreen = $separateTipScreen; } public function getCustomTipField(): ?bool { return $this->customTipField; } public function setCustomTipField(?bool $customTipField): void { $this->customTipField = $customTipField; } public function getTipPercentages(): ?array { return $this->tipPercentages; } public function setTipPercentages(?array $tipPercentages): void { $this->tipPercentages = $tipPercentages; } public function getSmartTipping(): ?bool { return $this->smartTipping; } public function setSmartTipping(?bool $smartTipping): void { $this->smartTipping = $smartTipping; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->allowTipping)) { $json['allow_tipping'] = $this->allowTipping; } if (isset($this->separateTipScreen)) { $json['separate_tip_screen'] = $this->separateTipScreen; } if (isset($this->customTipField)) { $json['custom_tip_field'] = $this->customTipField; } if (isset($this->tipPercentages)) { $json['tip_percentages'] = $this->tipPercentages; } if (isset($this->smartTipping)) { $json['smart_tipping'] = $this->smartTipping; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 