|
...
|
...
|
@@ -29,27 +29,18 @@ class Client implements ClientInterface |
|
|
|
*/
|
|
|
|
protected $config = [];
|
|
|
|
|
|
|
|
protected function __construct(RequestInterface $request)
|
|
|
|
{
|
|
|
|
$this->guzzleHttp = new GuzzleHttp([
|
|
|
|
'base_uri' => Arr::get($this->config, 'base_uri'),
|
|
|
|
'verify' => false
|
|
|
|
]);
|
|
|
|
$this->request = $request;
|
|
|
|
$this->config = config('gz-cbec');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param RequestInterface $request
|
|
|
|
* Client constructor.
|
|
|
|
*
|
|
|
|
* @return ClientInterface
|
|
|
|
* @param RequestInterface $request
|
|
|
|
*/
|
|
|
|
protected static function make(RequestInterface $request): ClientInterface
|
|
|
|
protected function __construct(RequestInterface $request)
|
|
|
|
{
|
|
|
|
return new static($request);
|
|
|
|
$this->request = $request;
|
|
|
|
$this->config = config('gz-cbec');
|
|
|
|
$this->guzzleHttp = new GuzzleHttp((array)Arr::get($this->config, 'client'));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ResponseInterface
|
|
|
|
* @throws Exception
|
|
...
|
...
|
@@ -77,13 +68,12 @@ class Client implements ClientInterface |
|
|
|
* @param RequestInterface $request
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public static function request(RequestInterface $request): array
|
|
|
|
{
|
|
|
|
$client = self::make($request);
|
|
|
|
/**
|
|
|
|
* @var ResponseInterface $response
|
|
|
|
*/
|
|
|
|
$client = new static($request);
|
|
|
|
|
|
|
|
$response = $client->send();
|
|
|
|
|
|
|
|
$content = $response->getBody()->getContents();
|
...
|
...
|
|