mirror of
https://github.com/bitinflow/bunny-cli.git
synced 2026-03-13 13:45:54 +00:00
first commit
This commit is contained in:
30
app/Bunny/Result.php
Normal file
30
app/Bunny/Result.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user