| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | class CorrelationID |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * @var string The correlation ID. |
||
| 26 | */ |
||
| 27 | protected static $uuid; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Turns this object into an UUID string. |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | * @throws \Exception |
||
| 34 | */ |
||
| 35 | 2 | public static function toString(): string |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Compares the current id against another |
||
| 46 | * |
||
| 47 | * @param string $otherID Other ID |
||
| 48 | * @return boolean |
||
| 49 | */ |
||
| 50 | 1 | public static function sameAs(string $otherID): bool |
|
| 51 | { |
||
| 52 | 1 | return static::$uuid === $otherID; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Generates a new correlation ID. |
||
| 57 | * |
||
| 58 | * @return \Ramsey\Uuid\UuidInterface |
||
| 59 | * @throws \Exception |
||
| 60 | */ |
||
| 61 | 1 | protected static function generate(): UuidInterface |
|
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Constructor. |
||
| 68 | * |
||
| 69 | * @codeCoverageIgnore |
||
| 70 | */ |
||
| 71 | private function __construct() |
||
| 73 | } |
||
| 74 | } |
||
| 75 |