* @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:----Mpu9IQw6OVLbv8CebYJ7qAhpJ5J0RXLnhuC3x4ymVkyIIsYKCPyQIFzKiEu2Bg8K0cExWfiGCX8mkB3IMj8AlyMpftpisz3sB5qdiJ5b/9sy18N21hvSb7avsHEOXbAVDcEHhTCXug4qAnpq64wu2Uf04hna4KCcZrFYB1kpqxe9X1XDmFFRfJB2GNfRqMQLbRW2iPrJlvPk5Xzz9NHEEM1iy/fE2lLrhIg+HC3ebgQL/1yB58YMv4sgju3NL3+YCBaA0Yk3C8Eu/3h7gy+mfhoHr833KAHqbAkBVvj917h1tODkh8I3ryee/VxTBOpw9ZwlEZ5TTFL7zL59SVN33RknPmOSKfGChx86BrHE2If+1qrUHfWrRva/f1azKz+zyso4VRg+v+glebW9DJ8LQF6aCY3BzciYx9f/7U7BR2Z/jZvxfPjng9H6ljBWOhQpD0y1v061PsmFjQmjecKHlSBj/kEZbqzEfQ00Su3U0F0sYsy3jqFENy3LxtcVaVCEbT3AEmeGksWfro3t6NtTJN7bjDtiumV6TL2aL8tLYaH5mLaiYYUiwsYZ5QvPaN3coxUJo0Bkl4rJ61SOzrKdqYf0kmIw5i7h/8oi+HN3K1tj3p1NLFMFY4ToJ55850Vd4JIwntVxHdkd886xuLyyNtsZ2yWmZxtVp9ucwopRhEA=----ATTACHMENT:----NTIxMDc0ODYzNTYyOTM5MiA2NDU5MjE1OTIzNTQzMDQ1IDE2MDY3MDE1MDM2OTUxODQ=