<?php
 declare(strict_types=1); namespace Square\Models; use stdClass; class ObtainTokenRequest implements \JsonSerializable { private $clientId; private $clientSecret; private $code; private $redirectUri; private $grantType; private $refreshToken; private $migrationToken; private $scopes; private $shortLived; public function __construct(string $clientId, string $clientSecret, string $grantType) { $this->clientId = $clientId; $this->clientSecret = $clientSecret; $this->grantType = $grantType; } public function getClientId(): string { return $this->clientId; } public function setClientId(string $clientId): void { $this->clientId = $clientId; } public function getClientSecret(): string { return $this->clientSecret; } public function setClientSecret(string $clientSecret): void { $this->clientSecret = $clientSecret; } public function getCode(): ?string { return $this->code; } public function setCode(?string $code): void { $this->code = $code; } public function getRedirectUri(): ?string { return $this->redirectUri; } public function setRedirectUri(?string $redirectUri): void { $this->redirectUri = $redirectUri; } public function getGrantType(): string { return $this->grantType; } public function setGrantType(string $grantType): void { $this->grantType = $grantType; } public function getRefreshToken(): ?string { return $this->refreshToken; } public function setRefreshToken(?string $refreshToken): void { $this->refreshToken = $refreshToken; } public function getMigrationToken(): ?string { return $this->migrationToken; } public function setMigrationToken(?string $migrationToken): void { $this->migrationToken = $migrationToken; } public function getScopes(): ?array { return $this->scopes; } public function setScopes(?array $scopes): void { $this->scopes = $scopes; } public function getShortLived(): ?bool { return $this->shortLived; } public function setShortLived(?bool $shortLived): void { $this->shortLived = $shortLived; } #[\ReturnTypeWillChange] public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['client_id'] = $this->clientId; $json['client_secret'] = $this->clientSecret; if (isset($this->code)) { $json['code'] = $this->code; } if (isset($this->redirectUri)) { $json['redirect_uri'] = $this->redirectUri; } $json['grant_type'] = $this->grantType; if (isset($this->refreshToken)) { $json['refresh_token'] = $this->refreshToken; } if (isset($this->migrationToken)) { $json['migration_token'] = $this->migrationToken; } if (isset($this->scopes)) { $json['scopes'] = $this->scopes; } if (isset($this->shortLived)) { $json['short_lived'] = $this->shortLived; } $json = array_filter($json, function ($val) { return $val !== null; }); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } } 