Skip to content

Commit 269ce10

Browse files
committed
Set defaults for variables and improved client check
1 parent a754867 commit 269ce10

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Picqer/Carriers/SendCloud/Connection.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class Connection
1212
private string $apiUrl = 'https://panel.sendcloud.sc/api/v2/';
1313
private string $apiKey;
1414
private string $apiSecret;
15-
private ?string $partnerId;
16-
private ?int $maxResponseSizeInBytes;
15+
private ?string $partnerId = null;
16+
private ?int $maxResponseSizeInBytes = null;
1717

18-
private Client $client;
18+
private ?Client $client = null;
1919
protected array $middleWares = [];
2020

2121
public function __construct(string $apiKey, string $apiSecret, ?string $partnerId = null)
@@ -27,7 +27,7 @@ public function __construct(string $apiKey, string $apiSecret, ?string $partnerI
2727

2828
public function client(): Client
2929
{
30-
if ($this->client) {
30+
if ($this->client instanceof Client) {
3131
return $this->client;
3232
}
3333

@@ -182,6 +182,11 @@ public function setMaxResponseSizeInBytes(?int $maxResponseSizeInBytes): void
182182
$this->maxResponseSizeInBytes = $maxResponseSizeInBytes;
183183
}
184184

185+
public function getMaxResponseSizeInBytes(): ?int
186+
{
187+
return $this->maxResponseSizeInBytes;
188+
}
189+
185190
public function download($url, array $headers = ['Accept' => 'application/pdf']): string
186191
{
187192
try {

0 commit comments

Comments
 (0)