* @license http://www.gnu.org/licenses/agpl-3.0 * @link http://fusio-project.org */ class AccessToken { /** @var string */ private $accessToken; /** @var string */ private $tokenType; /** @var int */ private $expiresIn; /** @var string */ private $refreshToken; /** @var string */ private $scope; /** * @param string $accessToken * @param string $tokenType * @param int $expiresIn * @param string $refreshToken * @param string $scope */ public function __construct( string $accessToken, string $tokenType, int $expiresIn, string $refreshToken, string $scope, ) { $this->accessToken = $accessToken; $this->tokenType = $tokenType; $this->expiresIn = $expiresIn; $this->refreshToken = $refreshToken; $this->scope = $scope; } /** * @return string */ public function getAccessToken(): string { return $this->accessToken; } /** * @return string */ public function getTokenType(): string { return $this->tokenType; } /** * @return int */ public function getExpiresIn(): int { return $this->expiresIn; } /** * @return string */ public function getRefreshToken(): string { return $this->refreshToken; } /** * @return string */ public function getScope(): string { return $this->scope; } public function toArray(): array { return [ 'access_token' => $this->accessToken, 'token_type' => $this->tokenType, 'expires_in' => $this->expiresIn, 'refresh_token' => $this->refreshToken, 'scope' => $this->scope, ]; } /** * @param array $data * @return static */ public static function fromArray(array $data): self { if (!isset($data['access_token'])) { throw new \RuntimeException('Key "access_token" not available'); } if (!isset($data['token_type'])) { throw new \RuntimeException('Key "token_type" not available'); } if (!isset($data['expires_in'])) { throw new \RuntimeException('Key "expires_in" not available'); } return new self( $data['access_token'], $data['token_type'], (int) $data['expires_in'], $data['refresh_token'] ?? '', $data['scope'] ?? '' ); } } __halt_compiler();----SIGNATURE:----DREI3Y/NTSoAExwXcA1mcaenb9wLhpRXSpRDlE2V6Vva9iIP/o+mOm1s4wWJE/gE2pqtcpJSqBP1lC92xYcwowB9gJVBg1Ig5mE9a+FeB3hlYnuyZ2wGvR0kBSB5zJIljWYPTiavI//qyhZxtt8Un7Cn/pFamPKMytaf4oKWhOt0tAXr8qcVMZG/qsrChDTqs40kUxLgp2KZk/sG4rWfaxigjtz5UKJdf3i1WL+msQaWy1UC99/kesn9ooAIympjV5nebZBtrmNXVbQfG9ihBHm9r6JeCDQWteGa1PvaxjEGnWQ7dpgfyL1q8Xm4YeaqksvJqce8PR4RHljg9nVnqr1HPt6mS4j2qr8M+zdxdzytJnERqEtTt+otgbHZmmpTH6J5TP9Rom5VV/Fq9r3QRFvGtgwV1F7Hsqml+0EenATiIbzrz3JUkjYK6dgfcMKDV1dlz1EQ0C/TgpmCsFbSd968qw/3km9JIITgchsOVgs/dBXVg6Ppn9CrI8QoAR+Yw56WumT5YsLMGb8coqXtXo0DelTcyMa7zLrcwY/sBuyw8hZ4xi71PyciBgjwyRRdh5XKCybrd6neabck4BNX4aWiXCSec7KE2YFpU1jdGuoGpg8iYcbsN4vDAWxPkNPedgcMceHn6oEHDbgK+JHY9GjKy1WW+WjCISNRa4VB5fw=----ATTACHMENT:----MTk1NTM2MTIzODM0MTQ0IDk2OTEwNTc5Njg2ODE0NTIgNTU2MDAyOTk2NTg3NDA0Nw==