Files
bunny-cli/app/Bunny/Result.php
René Preuß f42347aa99 first commit
2021-07-19 20:55:01 +02:00

31 lines
543 B
PHP

<?php
namespace App\Bunny;
use Psr\Http\Message\ResponseInterface;
class Result
{
private ResponseInterface $response;
private $data;
public function __construct(ResponseInterface $response)
{
$this->response = $response;
$this->data = json_decode($this->response->getBody()->getContents(), false);
}
public function getData()
{
return $this->data;
}
public function success(): bool
{
return in_array(floor($this->response->getStatusCode() / 100), [2]);
}
}