Created
March 19, 2021 10:17
-
-
Save Vasary/246a7a9343aa26a27bceb94ae78aca0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Infrastructure\Generator; | |
use Domain\Generator\TraceIdGeneratorInterface; | |
use Domain\GUIDGenerator\GUIDGeneratorInterface; | |
final class TraceIdProvider implements TraceIdGeneratorInterface | |
{ | |
private $generator; | |
private $traceId; | |
public function __construct(GUIDGeneratorInterface $generator) | |
{ | |
$this->generator = $generator; | |
$this->traceId = $this->generator->v4(); | |
} | |
public function set(string $traceId): void | |
{ | |
$this->traceId = $traceId; | |
} | |
public function get(): string | |
{ | |
return $this->traceId; | |
} | |
public function reset(): void | |
{ | |
$this->traceId = $this->generator->v4(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment