Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UuidV2 | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| createRandom | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Identifiers; |
| 3 | |
| 4 | use Apie\Core\Attributes\FakeMethod; |
| 5 | use Faker\Generator; |
| 6 | use Ramsey\Uuid\Uuid as RamseyUuid; |
| 7 | |
| 8 | #[FakeMethod("createRandom")] |
| 9 | class UuidV2 extends Uuid |
| 10 | { |
| 11 | public static function createRandom(Generator $generator): self |
| 12 | { |
| 13 | $uuid2 = RamseyUuid::uuid2( |
| 14 | $generator->randomElement([ |
| 15 | RamseyUuid::DCE_DOMAIN_PERSON, |
| 16 | RamseyUuid::DCE_DOMAIN_GROUP, |
| 17 | ]) |
| 18 | ); |
| 19 | |
| 20 | return static::fromNative($uuid2->toString()); |
| 21 | } |
| 22 | } |