Skip to content

Commit

Permalink
Set defaults for variables and improved client check
Browse files Browse the repository at this point in the history
  • Loading branch information
annajeanine committed Jun 24, 2024
1 parent a754867 commit 269ce10
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Picqer/Carriers/SendCloud/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class Connection
private string $apiUrl = 'https://panel.sendcloud.sc/api/v2/';
private string $apiKey;
private string $apiSecret;
private ?string $partnerId;
private ?int $maxResponseSizeInBytes;
private ?string $partnerId = null;
private ?int $maxResponseSizeInBytes = null;

private Client $client;
private ?Client $client = null;
protected array $middleWares = [];

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

public function client(): Client
{
if ($this->client) {
if ($this->client instanceof Client) {
return $this->client;
}

Expand Down Expand Up @@ -182,6 +182,11 @@ public function setMaxResponseSizeInBytes(?int $maxResponseSizeInBytes): void
$this->maxResponseSizeInBytes = $maxResponseSizeInBytes;
}

public function getMaxResponseSizeInBytes(): ?int
{
return $this->maxResponseSizeInBytes;
}

public function download($url, array $headers = ['Accept' => 'application/pdf']): string
{
try {
Expand Down

0 comments on commit 269ce10

Please sign in to comment.