Skip to content

Commit

Permalink
Add possibility of changing sdk name and version for implementers (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage authored Jan 4, 2022
1 parent cf0c1b2 commit 5cdc8e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Client/DefaultRegistrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public function __construct(
private readonly ClientInterface $httpClient,
private readonly RequestFactoryInterface $requestFactory,
private readonly UnleashConfiguration $configuration,
private ?string $sdkName = null,
private ?string $sdkVersion = null,
) {
$this->sdkName ??= 'unleash-client-php';
$this->sdkVersion ??= Unleash::SDK_VERSION;
}

/**
Expand All @@ -42,7 +46,7 @@ public function register(iterable $strategyHandlers): bool
->withBody(new StringStream(json_encode([
'appName' => $this->configuration->getAppName(),
'instanceId' => $this->configuration->getInstanceId(),
'sdkVersion' => 'unleash-client-php:' . Unleash::SDK_VERSION,
'sdkVersion' => $this->sdkName . ':' . $this->sdkVersion,
'strategies' => array_map(function (StrategyHandler $strategyHandler): string {
return $strategyHandler->getStrategyName();
}, $strategyHandlers),
Expand Down

0 comments on commit 5cdc8e2

Please sign in to comment.