Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mmelograno committed Dec 28, 2023
1 parent 847f160 commit 44be35d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
16 changes: 12 additions & 4 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,12 @@ public function getTreatmentsWithConfig(string $key, ?string $bucketingKey, arra
}
}

public function getTreatmentsByFlagSet(string $key, ?string $bucketingKey, string $flagSet, ?array $attributes): array
{
public function getTreatmentsByFlagSet(
string $key,
?string $bucketingKey,
string $flagSet,
?array $attributes
): array {
try {
// @TODO implement cache for this method

Expand All @@ -175,8 +179,12 @@ public function getTreatmentsByFlagSet(string $key, ?string $bucketingKey, strin
}
}

public function getTreatmentsWithConfigByFlagSet(string $key, ?string $bucketingKey, string $flagSet, ?array $attributes = null): array
{
public function getTreatmentsWithConfigByFlagSet(
string $key,
?string $bucketingKey,
string $flagSet,
?array $attributes = null
): array {
try {
// @TODO implement cache for this method

Expand Down
7 changes: 6 additions & 1 deletion src/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ function getTreatmentWithConfig(string $key, ?string $bucketingKey, string $feat
function getTreatments(string $key, ?string $bucketingKey, array $features, ?array $attributes): array;
function getTreatmentsWithConfig(string $key, ?string $bucketingKey, array $features, ?array $attributes): array;
function getTreatmentsByFlagSet(string $key, ?string $bucketingKey, string $flagSet, ?array $attributes): array;
function getTreatmentsWithConfigByFlagSet(string $key, ?string $bucketingKey, string $flagSet, ?array $attributes): array;
function getTreatmentsWithConfigByFlagSet(
string $key,
?string $bucketingKey,
string $flagSet,
?array $attributes
): array;
function track(string $key, string $trafficType, string $eventType, ?float $value = null, ?array $properties = null): bool;
}
7 changes: 6 additions & 1 deletion src/Link/Consumer/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ function getTreatmentWithConfig(string $key, ?string $bucketingKey, string $feat
function getTreatments(string $key, ?string $bucketingKey, array $features, ?array $attributes): array;
function getTreatmentsWithConfig(string $key, ?string $bucketingKey, array $features, ?array $attributes): array;
function getTreatmentsByFlagSet(string $key, ?string $bucketingKey, string $flagSet, ?array $attributes): array;
function getTreatmentsWithConfigByFlagSet(string $key, ?string $bucketingKey, string $flagSet, ?array $attributes): array;
function getTreatmentsWithConfigByFlagSet(
string $key,
?string $bucketingKey,
string $flagSet,
?array $attributes
): array;
function track(string $key, string $trafficType, string $eventType, ?float $value, ?array $properties): bool;
function splitNames(): array;
function split(string $splitName): ?SplitView;
Expand Down
10 changes: 7 additions & 3 deletions src/Link/Consumer/V1Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,20 @@ public function getTreatmentsByFlagSet(string $key, ?string $bucketingKey, strin
}


public function getTreatmentsWithConfigByFlagSet(string $key, ?string $bucketingKey, string $flagSet, ?array $attributes): array
{
public function getTreatmentsWithConfigByFlagSet(
string $key,
?string $bucketingKey,
string $flagSet,
?array $attributes
): array {
$response = Protocol\V1\TreatmentsByFlagSetResponse::fromRaw(
$this->rpcWithReconnect(RPC::forTreatmentsWithConfigByFlagSet($key, $bucketingKey, $flagSet, $attributes))
);
$response->ensureSuccess();

$results = [];

foreach($response->getEvaluationResults() as $feature=>$evalResult) {
foreach ($response->getEvaluationResults() as $feature => $evalResult) {
$results[$feature] = $evalResult == null
? ["control", null, null]
: [$evalResult->getTreatment(), $evalResult->getImpressionListenerdata(), $evalResult->getConfig()];
Expand Down
2 changes: 0 additions & 2 deletions src/Link/Protocol/V1/TreatmentsByFlagSetArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ class TreatmentsByFlagSetArgs extends Enum
private const BUCKETING_KEY = 1;
private const FLAG_SET = 2;
private const ATTRIBUTES = 3;

}

0 comments on commit 44be35d

Please sign in to comment.