Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
11 | 1 | public function __construct( |
|
12 | string $secretKey, |
||
13 | string $secretIV |
||
14 | ) { |
||
15 | // hash |
||
16 | 1 | $this->secretKey = hash('sha256', $secretKey); |
|
17 | // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning |
||
18 | 1 | $this->secretIV = substr(hash('sha256', $secretIV), 0, 16); |
|
19 | 1 | } |
|
20 | |||
42 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.