Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | final public static function fromString(string $value) |
||
32 | { |
||
33 | if (\strlen($value) !== Ksuid::ENCODED_SIZE) { |
||
34 | throw new InvalidIdentityException( |
||
35 | \sprintf('Provided identity value "%s" is not a valid KSUID.', $value) |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | try { |
||
40 | KsuidFactory::fromString($value); |
||
41 | } catch (\Exception $exception) { |
||
42 | throw new InvalidIdentityException( |
||
43 | \sprintf('Provided identity value "%s" is not a valid KSUID.', $value), |
||
44 | 0, |
||
45 | $exception |
||
46 | ); |
||
47 | } |
||
48 | |||
49 | return new static($value); |
||
50 | } |
||
52 |