| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public static function parse(string $greeting) : string |
||
| 25 | { |
||
| 26 | if (0 !== \strpos($greeting, 'Tarantool')) { |
||
| 27 | throw InvalidGreeting::invalidServerName(); |
||
| 28 | } |
||
| 29 | |||
| 30 | if (false === $salt = \base64_decode(\substr($greeting, 64, 44), true)) { |
||
| 31 | throw InvalidGreeting::invalidSalt(); |
||
| 32 | } |
||
| 33 | |||
| 34 | $salt = \substr($salt, 0, 20); |
||
| 35 | |||
| 36 | if (isset($salt[19])) { |
||
| 37 | return $salt; |
||
| 38 | } |
||
| 39 | |||
| 40 | throw InvalidGreeting::invalidSalt(); |
||
| 41 | } |
||
| 43 |