ohseesoftware/caddy-config-php

View on GitHub
src/Response.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace OhSeeSoftware\CaddyConfig;

use Psr\Http\Message\ResponseInterface;

class Response
{
    /** @var ResponseInterface */
    public $response;

    public function __construct(ResponseInterface $response)
    {
        $this->response = $response;
    }

    /**
     * Returns the response body as a string.
     *
     * @return string
     */
    public function getBody()
    {
        return $this->response->getBody()->getContents();
    }

    /**
     * Returns a boolean indicating if the request was successful.
     *
     * @return boolean
     */
    public function isSuccessful()
    {
        return in_array($this->response->getStatusCode(), [200, 201]);
    }
}