| Conditions | 4 | 
| Paths | 3 | 
| Total Lines | 20 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 31 | public static function fromString(string $value) | ||
| 32 |     { | ||
| 33 |         try { | ||
| 34 | $uuid = Uuid::fromString((new Hashids())->decodeHex($value)); | ||
| 35 |         } catch (InvalidUuidStringException $exception) { | ||
| 36 | throw new InvalidIdentityException( | ||
| 37 |                 \sprintf('Provided identity value "%s" is not a valid hashed UUID', $value), | ||
| 38 | 0, | ||
| 39 | $exception | ||
| 40 | ); | ||
| 41 | } | ||
| 42 | |||
| 43 |         if ($uuid->getVariant() !== Uuid::RFC_4122 || !\in_array($uuid->getVersion(), \range(1, 5), true)) { | ||
| 44 | throw new InvalidIdentityException( | ||
| 45 |                 \sprintf('Provided identity value "%s" is not a valid hashed UUID', $value) | ||
| 46 | ); | ||
| 47 | } | ||
| 48 | |||
| 49 | return new static($value); | ||
| 50 | } | ||
| 51 | } | ||
| 52 |