src/FlexibleHttpClient.php 1 location
|
@@ 27-31 (lines=5) @@
|
24 |
|
*/ |
25 |
|
public function __construct($client) |
26 |
|
{ |
27 |
|
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { |
28 |
|
throw new \TypeError( |
29 |
|
sprintf('%s::__construct(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) |
30 |
|
); |
31 |
|
} |
32 |
|
|
33 |
|
$this->httpClient = $client instanceof ClientInterface ? $client : new EmulatedHttpClient($client); |
34 |
|
$this->httpAsyncClient = $client instanceof HttpAsyncClient ? $client : new EmulatedHttpAsyncClient($client); |
src/HttpClientPool/HttpClientPool.php 1 location
|
@@ 33-37 (lines=5) @@
|
30 |
|
public function addHttpClient($client): void |
31 |
|
{ |
32 |
|
// no need to check for HttpClientPoolItem here, since it extends the other interfaces |
33 |
|
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { |
34 |
|
throw new \TypeError( |
35 |
|
sprintf('%s::addHttpClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) |
36 |
|
); |
37 |
|
} |
38 |
|
|
39 |
|
if (!$client instanceof HttpClientPoolItem) { |
40 |
|
$client = new HttpClientPoolItem($client); |
src/HttpClientPool/HttpClientPoolItem.php 1 location
|
@@ 62-66 (lines=5) @@
|
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; |
src/HttpClientRouter.php 1 location
|
@@ 49-53 (lines=5) @@
|
46 |
|
*/ |
47 |
|
public function addClient($client, RequestMatcher $requestMatcher): void |
48 |
|
{ |
49 |
|
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { |
50 |
|
throw new \TypeError( |
51 |
|
sprintf('%s::addClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) |
52 |
|
); |
53 |
|
} |
54 |
|
|
55 |
|
$this->clients[] = [ |
56 |
|
'matcher' => $requestMatcher, |
src/PluginClientBuilder.php 1 location
|
@@ 55-59 (lines=5) @@
|
52 |
|
*/ |
53 |
|
public function createClient($client): PluginClient |
54 |
|
{ |
55 |
|
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { |
56 |
|
throw new \TypeError( |
57 |
|
sprintf('%s::createClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) |
58 |
|
); |
59 |
|
} |
60 |
|
|
61 |
|
$plugins = $this->plugins; |
62 |
|
|
src/PluginClientFactory.php 1 location
|
@@ 52-56 (lines=5) @@
|
49 |
|
*/ |
50 |
|
public function createClient($client, array $plugins = [], array $options = []): PluginClient |
51 |
|
{ |
52 |
|
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) { |
53 |
|
throw new \TypeError( |
54 |
|
sprintf('%s::createClient(): Argument #1 ($client) must be of type %s|%s, %s given', self::class, ClientInterface::class, HttpAsyncClient::class, get_debug_type($client)) |
55 |
|
); |
56 |
|
} |
57 |
|
|
58 |
|
if (static::$factory) { |
59 |
|
$factory = static::$factory; |