| Conditions | 2 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | final public static function fromString(string $value) |
||
| 28 | { |
||
| 29 | try { |
||
| 30 | $decoded = \bin2hex((new Base62())->decode($value)); |
||
| 31 | |||
| 32 | static::uuidFromString(\sprintf('%s%s-%s-%s-%s-%s%s%s', ...\str_split($decoded, 4))); |
||
| 33 | } catch (\Exception $exception) { |
||
| 34 | throw new InvalidIdentityException( |
||
| 35 | \sprintf('Provided identity value "%s" is not a valid bas62 UUID.', $value), |
||
| 36 | 0, |
||
| 37 | $exception |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | |||
| 41 | return new static($value); |
||
| 42 | } |
||
| 63 |