Skip to content

Commit

Permalink
Make rootcertificate nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Aug 30, 2024
1 parent 5276eb9 commit 7f92d1c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ClientFactory
{
public static function create(string $apiKey, string $rootCertificate): KvKApiClient
public static function create(string $apiKey, ?string $rootCertificate = null): KvKApiClient
{
return new KvKApiClient(
self::createHttpClient($apiKey, $rootCertificate)
Expand All @@ -16,15 +16,21 @@ public static function create(string $apiKey, string $rootCertificate): KvKApiCl

private static function createHttpClient(
string $apiKey,
string $rootCertificate
?string $rootCertificate = null
) {
$client = new Client([
if ($rootCertificate === null) {
return new Client([
'headers' => [
'apikey' => $apiKey,
],
]);
}

return new Client([
'headers' => [
'apikey' => $apiKey,
],
'verify' => $rootCertificate,
]);

return $client;
}
}
}

0 comments on commit 7f92d1c

Please sign in to comment.