Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function generateEntropy() |
||
18 | { |
||
19 | try { |
||
20 | return bin2hex(random_bytes(64)); |
||
21 | } catch (Error $e) { |
||
22 | throw $e; // This is required so that Error exceptions in PHP 5 aren't caught below |
||
23 | } catch (Exception $e) { |
||
24 | throw new Exception( |
||
25 | 'It appears there is no suitable CSPRNG (random number generator) installed. ' |
||
26 | . 'Please review the server requirements documentation: ' |
||
27 | . 'https://docs.silverstripe.org/en/getting_started/server_requirements/' |
||
28 | ); |
||
29 | } |
||
30 | } |
||
31 | |||
47 |