Completed
Push — master ( 57f5d7...41a0f9 )
by Michael
01:41
created

OpenSSL::openssl_encrypt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 4
1
<?php
2
3
/**
4
 * OpenSSL.php
5
 *
6
 * PHP version 7
7
 *
8
 * @category Dcrypt
9
 * @package  Dcrypt
10
 * @author   Michael Meyer (mmeyer2k) <[email protected]>
11
 * @license  http://opensource.org/licenses/MIT The MIT License (MIT)
12
 * @link     https://github.com/mmeyer2k/dcrypt
13
 */
14
15
namespace Dcrypt;
16
17
class OpenSSL
18
{
19
    /**
20
     * OpenSSL encrypt wrapper function
21
     *
22
     * @param string $data
23
     * @param string $method
24
     * @param string $key
25
     * @param string $iv
26
     * @return string
27
     */
28
    protected static function openssl_encrypt(string $data, string $method, string $key, string $iv): string
29
    {
30
        return \openssl_encrypt($data, $method, $key, 1, $iv);
31
    }
32
33
    /**
34
     * OpenSSL decrypt wrapper function
35
     *
36
     * @param string $data
37
     * @param string $method
38
     * @param string $key
39
     * @param string $iv
40
     * @return string
41
     */
42
    protected static function openssl_decrypt(string $data, string $method, string $key, string $iv): string
43
    {
44
        return \openssl_decrypt($data, $method, $key, 1, $iv);
45
    }
46
}