| Conditions | 4 |
| Paths | 2 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 4.5923 |
| Changes | 0 | ||
| 1 | <?php |
||
| 46 | 2 | public function getRandomInt() |
|
| 47 | { |
||
| 48 | 2 | $random = openssl_random_pseudo_bytes($this->bytes, $strong); |
|
| 49 | 2 | if ($random === null || ($this->forceStrong && $strong !== true)) { |
|
| 50 | throw new \RuntimeException( |
||
| 51 | 'Random number generator algorithm didn\'t used "cryptographically strong" method.' |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | |||
| 55 | 2 | return hexdec(bin2hex($random)); |
|
| 56 | } |
||
| 57 | |||
| 58 | } |