Skip to content

Commit

Permalink
Fix rollout percentage methode name
Browse files Browse the repository at this point in the history
  • Loading branch information
ScullWM committed Oct 29, 2020
1 parent dd4a202 commit b6a4c5a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Retriever/VariantRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private function createVariantAllocation(Experiment $experiment): void
$this->allocations[$experiment->getName()] = [];
$variants = $experiment->getVariants();
foreach ($variants as $variant) {
$this->allocations[$experiment->getName()] = array_merge($this->allocations[$experiment->getName()], array_fill(0, $variant->getRolloutPercentage(), $variant));
$this->allocations[$experiment->getName()] = array_merge($this->allocations[$experiment->getName()], array_fill(0, $variant->getRollout(), $variant));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ValueObject/Experiment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct(string $name, Variant ...$variants)
if (!empty($variants)) {
$totalPercentage = 0;
foreach ($variants as $variant) {
$totalPercentage += $variant->getRolloutPercentage();
$totalPercentage += $variant->getRollout();
}
if ($totalPercentage !== 100) {
throw new LogicalException(sprintf('Differents variants do not reach 100%% got %d', $totalPercentage));
Expand Down
10 changes: 5 additions & 5 deletions src/ValueObject/Variant.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ class Variant
{
private string $name;

private int $rolloutPercentage;
private int $rollout;

public function __construct(string $name, int $rolloutPercentage = 50)
public function __construct(string $name, int $rollout = 50)
{
$this->name = $name;
$this->rolloutPercentage = $rolloutPercentage;
$this->rollout = $rollout;
}

public function getName(): string
{
return $this->name;
}

public function getRolloutPercentage(): int
public function getRollout(): int
{
return $this->rolloutPercentage;
return $this->rollout;
}

public function toString(): string
Expand Down

0 comments on commit b6a4c5a

Please sign in to comment.