| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | final class Greeting |
||
| 19 | { |
||
| 20 | public const SIZE_BYTES = 128; |
||
| 21 | |||
| 22 | private $greeting; |
||
| 23 | private $salt; |
||
| 24 | |||
| 25 | 220 | private function __construct() |
|
| 26 | { |
||
| 27 | 220 | unset($this->salt); |
|
| 28 | 220 | } |
|
| 29 | |||
| 30 | 262 | public static function parse(string $greeting) : self |
|
| 31 | { |
||
| 32 | 262 | if (0 !== \strpos($greeting, 'Tarantool')) { |
|
| 33 | 42 | throw InvalidGreeting::invalidServerName(); |
|
| 34 | } |
||
| 35 | |||
| 36 | 220 | $self = new self(); |
|
| 37 | 220 | $self->greeting = $greeting; |
|
| 38 | |||
| 39 | 220 | return $self; |
|
| 40 | } |
||
| 41 | |||
| 42 | 30 | public function getSalt() : string |
|
| 45 | } |
||
| 46 | |||
| 47 | 30 | public function __get($name) : string |
|
| 60 | } |
||
| 61 | } |
||
| 62 |