Lines
100.00%
2 / 2
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| CorrelationIdSequence | 100.00% | 2 / 2 | 100.00% | 2 / 2 | 2 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| issueNext | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Runtime\Worker; | |
| 6 | ||
| 7 | use Stewart\Runtime\Model\CorrelationId; | |
| 8 | use Stewart\Runtime\Model\WorkerId; | |
| 9 | ||
| 10 | final class CorrelationIdSequence | |
| 11 | { | |
| 12 | private int $issued = 0; | |
| 13 | ||
| 14 | public function __construct(private readonly WorkerId $workerId) {} | |
| 15 | ||
| 16 | public function issueNext(): CorrelationId | |
| 17 | { | |
| 18 | return CorrelationId::fromString($this->workerId->value . ':' . $this->issued++); | |
| 19 | } | |
| 20 | } |