Skip to content

Commit

Permalink
Add httpClient as an optional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
lbacik committed Apr 18, 2024
1 parent 2c8b516 commit ea33297
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/SDK/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@
use JsonHub\SDK\Client\MapperService;
use JsonHub\SDK\Client\RequestFactory;
use JsonHub\SDK\Client\UrlFactory;
use Psr\Http\Client\ClientInterface;
use Psr\Log\LoggerInterface;

class ClientFactory
{
public static function create(string $apiUrl, LoggerInterface|null $logger = null): Client
{
public static function create(
string $apiUrl,
LoggerInterface|null $logger = null,
ClientInterface|null $httpClient = null,
): Client {
return new Client(
new GuzzleClient(),
$httpClient ?? new GuzzleClient(),
new RequestFactory(
new UrlFactory($apiUrl)
),
Expand Down

0 comments on commit ea33297

Please sign in to comment.