| 1 | <?php |
||
| 10 | final class SequenceSet |
||
| 11 | { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var array |
||
| 15 | */ |
||
| 16 | private $set = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * SequenceSet constructor. |
||
| 20 | */ |
||
| 21 | 14 | private function __construct() |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @param int $number |
||
| 29 | * @return SequenceSet |
||
| 30 | */ |
||
| 31 | 1 | public function withSingle(int $number): self |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @param int $first |
||
| 40 | * @param int $last |
||
| 41 | * @return SequenceSet |
||
| 42 | */ |
||
| 43 | 1 | public function withRange(int $first, int $last): self |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @param int $first |
||
| 52 | * @return SequenceSet |
||
| 53 | */ |
||
| 54 | 1 | public function withInfiniteRange(int $first): self |
|
| 60 | |||
| 61 | /** |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | 14 | public function __toString(): string |
|
| 68 | |||
| 69 | /** |
||
| 70 | * @return SequenceSet |
||
| 71 | */ |
||
| 72 | 1 | public static function all(): self |
|
| 78 | |||
| 79 | /** |
||
| 80 | * @param int $number |
||
| 81 | * @return SequenceSet |
||
| 82 | */ |
||
| 83 | 9 | public static function single(int $number): self |
|
| 89 | |||
| 90 | /** |
||
| 91 | * @param int $first |
||
| 92 | * @param int $last |
||
| 93 | * @return SequenceSet |
||
| 94 | */ |
||
| 95 | 3 | public static function range(int $first, int $last): self |
|
| 101 | |||
| 102 | /** |
||
| 103 | * @param int $first |
||
| 104 | * @return SequenceSet |
||
| 105 | */ |
||
| 106 | 1 | public static function infiniteRange(int $first): self |
|
| 112 | } |