| 1 | <?php |
||
| 7 | class CorrelationIdProvider |
||
| 8 | { |
||
| 9 | private $correlationId; |
||
| 10 | private $increment; |
||
| 11 | |||
| 12 | public function __construct(string $systemName) |
||
| 13 | { |
||
| 14 | $this->correlationId = uniqid($systemName, true); |
||
| 15 | $this->increment = 0; |
||
| 16 | } |
||
| 17 | |||
| 18 | public function getCorrelationId(): string |
||
| 19 | { |
||
| 20 | if ($this->increment === 0) { |
||
| 21 | return $this->correlationId; |
||
| 22 | } |
||
| 23 | |||
| 24 | return sprintf('%s_%s', $this->correlationId, $this->increment); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function incrementIdentifier() |
||
| 31 | } |
||
| 32 |