play-code-live/vkplay-live-sdk

View on GitHub
src/Response/TokenResponse.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

namespace PlayCode\VKPlayLiveSDK\Response;

class TokenResponse extends JsonResponse
{
    public readonly string $accessToken;
    public readonly string $refreshToken;
    public readonly int $expiresIn;
    public readonly string $tokenType;

    protected function buildFromBody(array $data): void
    {
        $this->accessToken = $data['access_token'] ?? '';
        $this->refreshToken = $data['refresh_token'] ?? '';
        $this->expiresIn = $data['expires_in'] ?? 0;
        $this->tokenType = $data['token_type'] ?? '';
    }
}