Skip to content

Commit

Permalink
chore: Replace HttpClientDiscovery to Psr18ClientDiscovery, MessageFa…
Browse files Browse the repository at this point in the history
…ctoryDiscovery to Psr17FactoryDiscovery and Http\Client\HttpClient to Psr\Http\Client\ClientInterface
  • Loading branch information
Fábio Galvão committed Apr 15, 2024
1 parent 8b1d990 commit f6aa5e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/Common/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

namespace Omnipay\Common\Http;

use function GuzzleHttp\Psr7\str;
use Http\Client\HttpClient;
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\MessageFactoryDiscovery;
use Psr\Http\Client\ClientInterface as HttpClientInterface;
use Http\Discovery\Psr18ClientDiscovery;
use Http\Discovery\Psr17FactoryDiscovery;
use Omnipay\Common\Http\Exception\NetworkException;
use Omnipay\Common\Http\Exception\RequestException;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;

class Client implements ClientInterface
Expand All @@ -20,7 +18,7 @@ class Client implements ClientInterface
* The Http Client which implements `public function sendRequest(RequestInterface $request)`
* Note: Will be changed to PSR-18 when released
*
* @var HttpClient
* @var HttpClientInterface
*/
private $httpClient;

Expand All @@ -31,8 +29,8 @@ class Client implements ClientInterface

public function __construct($httpClient = null, RequestFactoryInterface $requestFactory = null)
{
$this->httpClient = $httpClient ?: HttpClientDiscovery::find();
$this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find();
$this->httpClient = $httpClient ?: Psr18ClientDiscovery::find();
$this->requestFactory = $requestFactory ?: Psr17FactoryDiscovery::findRequestFactory();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Common/Http/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Http\Client\Exception\NetworkException;
use Mockery as m;
use GuzzleHttp\Psr7\Request;
use Http\Client\HttpClient;
use Psr\Http\Client\ClientInterface as HttpClient;
use Psr\Http\Message\RequestFactoryInterface as RequestFactory;
use Omnipay\Common\Http\Exception\RequestException;
use Omnipay\Tests\TestCase;
Expand Down

0 comments on commit f6aa5e8

Please sign in to comment.