Skip to content

Commit

Permalink
Add support for an union of ClientInterfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafikooo committed Jan 18, 2024
1 parent 635d07b commit e4db28e
Showing 1 changed file with 10 additions and 33 deletions.
43 changes: 10 additions & 33 deletions src/Client/PayPalClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

namespace Sylius\PayPalPlugin\Client;

use GuzzleHttp\ClientInterface;
use GuzzleHttp\ClientInterface as DeprecatedClientInterface;
use Psr\Http\Client\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -27,40 +28,16 @@

final class PayPalClient implements PayPalClientInterface
{
private ClientInterface $client;

private LoggerInterface $logger;

private UuidProviderInterface $uuidProvider;

private PayPalConfigurationProviderInterface $payPalConfigurationProvider;

private ChannelContextInterface $channelContext;

private string $baseUrl;

private int $requestTrialsLimit;

private bool $loggingLevelIncreased;

public function __construct(
ClientInterface $client,
LoggerInterface $logger,
UuidProviderInterface $uuidProvider,
PayPalConfigurationProviderInterface $payPalConfigurationProvider,
ChannelContextInterface $channelContext,
string $baseUrl,
int $requestTrialsLimit,
bool $loggingLevelIncreased = false
private ClientInterface|DeprecatedClientInterface $client,
private LoggerInterface $logger,
private UuidProviderInterface $uuidProvider,
private PayPalConfigurationProviderInterface $payPalConfigurationProvider,
private ChannelContextInterface $channelContext,
private string $baseUrl,
private int $requestTrialsLimit,
private bool $loggingLevelIncreased = false
) {
$this->client = $client;
$this->logger = $logger;
$this->uuidProvider = $uuidProvider;
$this->payPalConfigurationProvider = $payPalConfigurationProvider;
$this->channelContext = $channelContext;
$this->baseUrl = $baseUrl;
$this->requestTrialsLimit = $requestTrialsLimit;
$this->loggingLevelIncreased = $loggingLevelIncreased;
}

public function authorize(string $clientId, string $clientSecret): array
Expand Down

0 comments on commit e4db28e

Please sign in to comment.