We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 24eff07 commit cfa8f66Copy full SHA for cfa8f66
1 file changed
src/Http/Builder.php
@@ -14,21 +14,15 @@
14
15
class Builder
16
{
17
- protected ClientInterface $baseClient;
18
-
19
- public function getClient(): ClientInterface
20
- {
21
- if (empty($this->baseClient)) {
22
- $this->baseClient = Psr18ClientDiscovery::find();
23
- }
24
25
- return $this->baseClient;
+ protected ?ClientInterface $client;
+ public function __construct(ClientInterface $client = null) {
+ $this->client = $client ?: Psr18ClientDiscovery::find();
26
}
27
28
public function build(Config $config): Transport
29
30
return new Transport(
31
- $this->getClient(),
+ $this->client,
32
$config
33
);
34
0 commit comments