Total Complexity | 2 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
17 | class SequentialGenerator implements UuidGenerator |
||
18 | { |
||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | private $counter; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $head; |
||
28 | |||
29 | /** |
||
30 | * @example $mark = 15 and $start = 10 will generate: |
||
31 | * '00000000-0000-000f-0000-00000000000a' |
||
32 | * '00000000-0000-000f-0000-00000000000b' |
||
33 | * '00000000-0000-000f-0000-00000000000c' |
||
34 | * ... |
||
35 | */ |
||
36 | 3 | public function __construct(int $mark = 0, int $start = 0) |
|
37 | { |
||
38 | 3 | $this->head = \pack('J', $mark); |
|
39 | 3 | $this->counter = $start; |
|
40 | 3 | } |
|
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | 3 | public function generate(string $name = null): Uuid |
|
48 | } |
||
49 | } |
||
50 |