Total Complexity | 3 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | class HashUuidIdentity extends AbstractUuidIdentity |
||
23 | { |
||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | final public static function fromString(string $value) |
||
28 | { |
||
29 | try { |
||
30 | static::uuidFromString((new Hashids())->decodeHex($value)); |
||
31 | } catch (InvalidIdentityException $exception) { |
||
32 | throw new InvalidIdentityException( |
||
33 | \sprintf('Provided identity value "%s" is not a valid hashed UUID.', $value), |
||
34 | 0, |
||
35 | $exception |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | return new static($value); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Get identity from UUID string. |
||
44 | * |
||
45 | * @param string $value |
||
46 | * |
||
47 | * @throws InvalidIdentityException |
||
48 | * |
||
49 | * @return mixed|static |
||
50 | */ |
||
51 | final public static function fromUuid(string $value) |
||
56 | } |
||
57 | } |
||
58 |