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