Total Complexity | 5 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
8 | final class Utils |
||
9 | { |
||
10 | /** |
||
11 | * Securely erases a memory block |
||
12 | * |
||
13 | * @param string $data |
||
14 | * @return boolean |
||
15 | */ |
||
16 | public static function zero(string &$data) : bool |
||
17 | { |
||
18 | return \sodium_memzero($data) === null; |
||
|
|||
19 | } |
||
20 | |||
21 | /** |
||
22 | * Generates a crypto keypair |
||
23 | * |
||
24 | * @return \ncryptf\Keypair |
||
25 | */ |
||
26 | public static function generateKeypair() : Keypair |
||
27 | { |
||
28 | try { |
||
29 | $keypair = \sodium_crypto_box_keypair(); |
||
30 | return new Keypair( |
||
31 | \sodium_crypto_box_secretkey($keypair), |
||
32 | \sodium_crypto_box_publickey($keypair) |
||
33 | ); |
||
34 | } catch (SodiumException $e) { |
||
35 | throw new Exception($e->getMessage()); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Generates a signing keypair |
||
41 | * |
||
42 | * @return \ncryptf\Keypair |
||
43 | */ |
||
44 | public static function generateSigningKeypair() : Keypair |
||
54 | } |
||
55 | } |
||
56 | } |
||
57 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.