| Total Complexity | 3 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | final class RecoveryCode |
||
| 10 | { |
||
| 11 | private $value; |
||
| 12 | |||
| 13 | 7 | public function __construct() |
|
| 14 | { |
||
| 15 | 7 | $this->value = (string) Str::of(bin2hex(random_bytes(16)))->substring(0, 8); |
|
| 16 | 7 | } |
|
| 17 | |||
| 18 | 5 | public function equals(Code $code): bool |
|
| 19 | { |
||
| 20 | 5 | return \hash_equals((string) $code, $this->value); |
|
| 21 | } |
||
| 22 | |||
| 23 | 3 | public function __toString(): string |
|
| 26 | } |
||
| 27 | } |
||
| 28 |