*/ private array $numbers; private ?string $range; public function __construct(int ...$numbers) { $this->numbers = $numbers; $this->range = null; } public static function range(int $from, int $to): self { $set = new self(); $set->range = $from . ':' . $to; return $set; } public function __toString(): string { if ($this->range !== null) { return $this->range; } return implode(',', $this->numbers); } }