implement getError method

This commit is contained in:
ghost 2024-02-18 03:55:40 +02:00
parent 8792ade0e5
commit 5b5764939d

View File

@ -85,19 +85,7 @@ class Client
bool $json = true
): ?array
{
$response = curl_exec(
$this->_curl
);
$errorNumber = curl_errno(
$this->_curl
);
$errorText = curl_error(
$this->_curl
);
if ($response)
if ($response = curl_exec($this->_curl))
{
return $json ? json_decode($response, true) : $response;
}
@ -105,6 +93,17 @@ class Client
return null;
}
public function getError(?int &$code = null): mixed
{
$code = curl_errno(
$this->_curl
);
return curl_error(
$this->_curl
);
}
public function getBlockCount(): ?int
{
$this->_id++;