accessToken = $accessToken; $this->refreshToken = $refreshToken; $this->expirationDate = new DateTimeImmutable( "+{$expiresInSeconds} seconds"); } public function getAccessToken(): string { return $this->accessToken; } public function getRefreshToken(): string { return $this->refreshToken; } public function isExpired(): bool { return new DateTime('now') > $this->expirationDate; } public static function fromResponse(ResponseInterface $response): self { $tokenInformation = json_decode($response->getBody()->getContents(), true); return new static($tokenInformation['access_token'], $tokenInformation['refresh_token'], $tokenInformation['expires_in']); } }