play-code-live/vkplay-live-sdk

View on GitHub
src/Response/Response.php

Summary

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

declare(strict_types=1);

namespace PlayCode\VKPlayLiveSDK\Response;

class Response implements ResponseInterface
{
    protected string $body;
    private int $statusCode;

    public function __construct(string $body, int $statusCode)
    {
        $this->body = $body;
        $this->statusCode = $statusCode;
    }

    public function getBody(): string
    {
        return $this->body;
    }

    public function getStatusCode(): int
    {
        return $this->statusCode;
    }

    public static function createFromResponse(ResponseInterface $response): static
    {
        return new static($response->getBody(), $response->getStatusCode());
    }
}