| Conditions | 3 |
| Paths | 3 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.0261 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 3 | public function cekForEncryption(int $length): string |
|
| 20 | { |
||
| 21 | 3 | if ($length < 1) { |
|
| 22 | 1 | throw new \InvalidArgumentException('Length must be greater than 0.'); |
|
| 23 | } |
||
| 24 | 2 | $ret = openssl_random_pseudo_bytes($length); |
|
| 25 | 2 | if (false === $ret) { |
|
| 26 | throw new \RuntimeException('openssl_random_pseudo_bytes() failed.'); |
||
| 27 | } |
||
| 28 | 2 | return $ret; |
|
| 29 | } |
||
| 31 |