charitable
/
vendor
/
square
/
square
/
src
/
Legacy
/
Models
/
DeviceComponentDetailsCardReaderDetails.php
DeviceComponentDetailsCardReaderDetails.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/DeviceComponentDetailsCardReaderDetails.php
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Square\Legacy\Models; |
| 6 | |
| 7 | use stdClass; |
| 8 | |
| 9 | class DeviceComponentDetailsCardReaderDetails implements \JsonSerializable |
| 10 | { |
| 11 | /** |
| 12 | * @var string|null |
| 13 | */ |
| 14 | private $version; |
| 15 | |
| 16 | /** |
| 17 | * Returns Version. |
| 18 | * The version of the card reader. |
| 19 | */ |
| 20 | public function getVersion(): ?string |
| 21 | { |
| 22 | return $this->version; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Sets Version. |
| 27 | * The version of the card reader. |
| 28 | * |
| 29 | * @maps version |
| 30 | */ |
| 31 | public function setVersion(?string $version): void |
| 32 | { |
| 33 | $this->version = $version; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Encode this object to JSON |
| 38 | * |
| 39 | * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 40 | * are set. (default: false) |
| 41 | * |
| 42 | * @return array|stdClass |
| 43 | */ |
| 44 | #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 45 | public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 46 | { |
| 47 | $json = []; |
| 48 | if (isset($this->version)) { |
| 49 | $json['version'] = $this->version; |
| 50 | } |
| 51 | $json = array_filter($json, function ($val) { |
| 52 | return $val !== null; |
| 53 | }); |
| 54 | |
| 55 | return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 56 | } |
| 57 | } |
| 58 |