Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Uuid5EmbeddedIdMinter | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| mint | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Model; |
| 6 | |
| 7 | use LambdaTwelve\OneRecord\Rdf\Iri; |
| 8 | use LambdaTwelve\OneRecord\Spec\Namespaces; |
| 9 | |
| 10 | /** |
| 11 | * The spec's recommended scheme: `internal:<uuid5>`, derived from the parent |
| 12 | * object's URI and a discriminator, so the same input never yields two ids |
| 13 | * and the ids are unique across the server. |
| 14 | */ |
| 15 | final class Uuid5EmbeddedIdMinter implements EmbeddedIdMinter |
| 16 | { |
| 17 | public function mint(Iri $parent, string $discriminator): Iri |
| 18 | { |
| 19 | return new Iri(Namespaces::EMBEDDED . Uuid::v5(Uuid::NAMESPACE_URL, $parent->value . '#' . $discriminator)); |
| 20 | } |
| 21 | } |