Skip to content

Commit

Permalink
IBX-6827: Allow to add label aggregation ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Oct 22, 2023
1 parent 982b837 commit 4c82159
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ final class Range extends ValueObject
*/
private $to;

public function __construct($from, $to)
private ?string $label;

public function __construct($from, $to, ?string $label = null)
{
parent::__construct();

$this->from = $from;
$this->to = $to;
$this->label = $label;
}

public function getFrom()
Expand All @@ -45,8 +48,27 @@ public function getTo()
return $this->to;
}

public function getLabel(): ?string
{
return $this->label;
}

public function setLabel(?string $label): void
{
$this->label = $label;
}

public function __toString(): string
{
if ($this->label !== null) {
return sprintf(
'%s:[%s;%s)',
$this->label,
$this->getRangeValueAsString($this->from),
$this->getRangeValueAsString($this->to)
);
}

return sprintf(
'[%s;%s)',
$this->getRangeValueAsString($this->from),
Expand Down

0 comments on commit 4c82159

Please sign in to comment.