Jobs setup
This commit is contained in:
@ -4,29 +4,12 @@ namespace ProVM\Service;
|
||||
use HttpResponseException;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Safe\Exceptions\JsonException;
|
||||
use function Safe\json_encode;
|
||||
|
||||
class Communicator
|
||||
{
|
||||
public function __construct(ClientInterface $client)
|
||||
{
|
||||
$this->setClient($client);
|
||||
}
|
||||
|
||||
protected ClientInterface $client;
|
||||
|
||||
public function getClient(): ClientInterface
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(ClientInterface $client): Communicator
|
||||
{
|
||||
$this->client = $client;
|
||||
return $this;
|
||||
}
|
||||
public function __construct(protected ClientInterface $client) {}
|
||||
|
||||
/**
|
||||
* @throws HttpResponseException
|
||||
@ -52,7 +35,7 @@ class Communicator
|
||||
];
|
||||
$options['body'] = json_encode($body);
|
||||
}
|
||||
return $this->handleResponse($this->getClient()->request($method, $uri, $options));
|
||||
return $this->handleResponse($this->client->request($method, $uri, $options));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user