| Conditions | 2 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 2 | public function hash(string $password): string |
|
| 38 | { |
||
| 39 | 2 | set_error_handler([self::class, 'errorHandler']); |
|
| 40 | try { |
||
| 41 | 2 | $hash = password_hash($password, $this->algorithm, $this->options); |
|
| 42 | 1 | } catch (ErrorException $exception) { |
|
| 43 | 1 | throw new RuntimeException('An error occurred while hashing the password.', /*code*/0, $exception); |
|
| 44 | 1 | } finally { |
|
| 45 | 2 | restore_error_handler(); |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | assert($hash !== false); |
|
| 49 | |||
| 50 | 1 | return $hash; |
|
| 51 | } |
||
| 69 |