@@ 60-70 (lines=11) @@ | ||
57 | * @param ClientInterface|HttpAsyncClient $client |
|
58 | * @param int|null $reenableAfter Number of seconds until this client is enabled again after an error |
|
59 | */ |
|
60 | public function __construct($client, int $reenableAfter = null) |
|
61 | { |
|
62 | if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { |
|
63 | throw new \TypeError( |
|
64 | sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) |
|
65 | ); |
|
66 | } |
|
67 | ||
68 | $this->client = new FlexibleHttpClient($client); |
|
69 | $this->reenableAfter = $reenableAfter; |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * {@inheritdoc} |
@@ 28-38 (lines=11) @@ | ||
25 | /** |
|
26 | * @param RequestFactory|RequestFactoryInterface |
|
27 | */ |
|
28 | public function __construct(ClientInterface $httpClient, $requestFactory) |
|
29 | { |
|
30 | if (!$requestFactory instanceof RequestFactory && !$requestFactory instanceof RequestFactoryInterface) { |
|
31 | throw new \TypeError( |
|
32 | sprintf('%s::__construct(): Argument #2 ($requestFactory) must be of type %s|%s, %s given', self::class, RequestFactory::class, RequestFactoryInterface::class, get_debug_type($requestFactory)) |
|
33 | ); |
|
34 | } |
|
35 | ||
36 | $this->httpClient = $httpClient; |
|
37 | $this->requestFactory = $requestFactory; |
|
38 | } |
|
39 | ||
40 | public function get($uri, array $headers = []): ResponseInterface |
|
41 | { |