| 1 | <?php |
||
| 6 | final class SequenceSet |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * @var array<int, mixed> |
||
| 10 | */ |
||
| 11 | private $set = []; |
||
| 12 | |||
| 13 | 15 | private function __construct() |
|
| 18 | |||
| 19 | /** |
||
| 20 | * @param int $number |
||
| 21 | * @return SequenceSet |
||
| 22 | */ |
||
| 23 | 1 | public function withSingle(int $number): self |
|
| 29 | |||
| 30 | /** |
||
| 31 | * @param int $first |
||
| 32 | * @param int $last |
||
| 33 | * @return SequenceSet |
||
| 34 | */ |
||
| 35 | 1 | public function withRange(int $first, int $last): self |
|
| 41 | |||
| 42 | /** |
||
| 43 | * @param int $first |
||
| 44 | * @return SequenceSet |
||
| 45 | */ |
||
| 46 | 1 | public function withInfiniteRange(int $first): self |
|
| 52 | |||
| 53 | /** |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | 15 | public function __toString(): string |
|
| 60 | |||
| 61 | /** |
||
| 62 | * @return SequenceSet |
||
| 63 | */ |
||
| 64 | 1 | public static function all(): self |
|
| 70 | |||
| 71 | /** |
||
| 72 | * @param int $number |
||
| 73 | * @return SequenceSet |
||
| 74 | */ |
||
| 75 | 10 | public static function single(int $number): self |
|
| 81 | |||
| 82 | /** |
||
| 83 | * @param array<int, int> $numbers |
||
| 84 | * @return SequenceSet |
||
| 85 | */ |
||
| 86 | public static function multiple(array $numbers): self |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @param int $first |
||
| 95 | * @param int $last |
||
| 96 | * @return SequenceSet |
||
| 97 | */ |
||
| 98 | 3 | public static function range(int $first, int $last): self |
|
| 104 | |||
| 105 | /** |
||
| 106 | * @param int $first |
||
| 107 | * @return SequenceSet |
||
| 108 | */ |
||
| 109 | 1 | public static function infiniteRange(int $first): self |
|
| 115 | } |
||
| 116 |