@@ 78-89 (lines=12) @@ | ||
75 | /** |
|
76 | * {@inheritDoc} |
|
77 | */ |
|
78 | public static function encode( |
|
79 | /*# string */ $uuid, |
|
80 | /*# string */ $base = self::BASE56 |
|
81 | )/*# : string */ { |
|
82 | if (static::isValid($uuid)) { |
|
83 | return static::convertBase($uuid, self::BASE16, $base); |
|
84 | } |
|
85 | throw new LogicException( |
|
86 | Message::get(Message::UUID_INVALID, $uuid), |
|
87 | Message::UUID_INVALID |
|
88 | ); |
|
89 | } |
|
90 | ||
91 | /** |
|
92 | * {@inheritDoc} |
|
@@ 94-106 (lines=13) @@ | ||
91 | /** |
|
92 | * {@inheritDoc} |
|
93 | */ |
|
94 | public static function decode( |
|
95 | /*# string */ $string, |
|
96 | /*# string */ $base = self::BASE56 |
|
97 | )/*# : string */ { |
|
98 | $uuid = static::convertBase($string, $base, self::BASE16); |
|
99 | if (static::isValid($uuid)) { |
|
100 | return $uuid; |
|
101 | } |
|
102 | throw new LogicException( |
|
103 | Message::get(Message::UUID_DECODE_FAIL, $string), |
|
104 | Message::UUID_DECODE_FAIL |
|
105 | ); |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * Convert numerical string between bases |