Browse Source

implement getError method

main
ghost 9 months ago
parent
commit
5b5764939d
  1. 23
      src/Client.php

23
src/Client.php

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

Loading…
Cancel
Save