| Total Complexity | 7 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 78.56% |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 15 | class OpenSslGenerator implements Generator |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Length of the desired string of bytes |
||
| 19 | * |
||
| 20 | * @var int |
||
| 21 | */ |
||
| 22 | protected $bytes = PHP_INT_SIZE; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Force strong random number generation or "die" |
||
| 26 | * |
||
| 27 | * @var bool |
||
| 28 | */ |
||
| 29 | protected $forceStrong = true; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param int $bytes Bytes to use in the result |
||
| 33 | * @param bool $forceStrong Force strong random number generation |
||
| 34 | */ |
||
| 35 | 5 | public function __construct(int $bytes = PHP_INT_SIZE, bool $forceStrong = true) |
|
| 43 | } |
||
| 44 | |||
| 45 | 1 | public function isForceStrong(): bool |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @inheritdoc |
||
| 52 | * @see https://php.net/manual/en/function.openssl-random-pseudo-bytes.php |
||
| 53 | * @throws RuntimeException |
||
| 54 | */ |
||
| 55 | 2 | public function getRandomInt() |
|
| 67 |