Skip to content

Commit cfa8f66

Browse files
committed
cleanup for builder of transport
1 parent 24eff07 commit cfa8f66

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/Http/Builder.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,15 @@
1414

1515
class Builder
1616
{
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;
17+
protected ?ClientInterface $client;
18+
public function __construct(ClientInterface $client = null) {
19+
$this->client = $client ?: Psr18ClientDiscovery::find();
2620
}
2721

2822
public function build(Config $config): Transport
2923
{
3024
return new Transport(
31-
$this->getClient(),
25+
$this->client,
3226
$config
3327
);
3428
}

0 commit comments

Comments
 (0)