t411-console/src/Api/ClientResponse.php

42 lines
706 B
PHP

<?php
namespace Api;
class ClientResponse
{
protected $response = null;
public function __construct(FutureInterface $response)
{
$this->response = $response;
}
public function hasError()
{
return isset($this->response->json()['error']);
}
public function getErrorCode()
{
if ($this->hasError()) {
return null;
}
return $this->response->json()['code'];
}
public function getErrorMessage()
{
if ($this->hasError()) {
return null;
}
return $this->response->json()['error'];
}
public function getData()
{
return $this->response->json();
}
}