feat : Decorator Http
This commit is contained in:
28
app/Lib/Request/GuzzleHttpClient.php
Normal file
28
app/Lib/Request/GuzzleHttpClient.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Lib\Request;
|
||||
|
||||
use App\Interface\Test\Decorator\HttpClientInterface;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class GuzzleHttpClient implements HttpClientInterface
|
||||
{
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param array $options
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function request(
|
||||
string $method,
|
||||
string $url,
|
||||
array $options = []
|
||||
): ResponseInterface
|
||||
{
|
||||
$client = new Client();
|
||||
return $client->request($method, $url, $options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user