Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | 70 | public static function parseGreeting($greeting) |
|
38 | { |
||
39 | 70 | if ('Tarantool' !== substr($greeting, 0, 9)) { |
|
40 | 21 | throw new Exception('Invalid greeting: unable to recognize Tarantool server.'); |
|
41 | } |
||
42 | |||
43 | 49 | $salt = substr(base64_decode(substr($greeting, 64, 44), true), 0, 20); |
|
44 | |||
45 | 49 | if (isset($salt[19])) { |
|
46 | 39 | return $salt; |
|
47 | } |
||
48 | |||
49 | 10 | throw new Exception('Invalid greeting: unable to parse salt.'); |
|
50 | } |
||
51 | } |
||
52 |