Completed
Push — master ( e64f37...ec241f )
by Jared
02:07
created

EncryptCache::getIv()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: jaredchu
5
 * Date: 09/08/2017
6
 * Time: 16:22
7
 */
8
9
namespace JC;
10
11
/**
12
 * Class EncryptCache
13
 * @package JC
14
 */
15
class EncryptCache extends SimpleCache
16
{
17
    const MANAGER = EncryptManager::class;
18
19
    /**
20
     * @return string
21
     */
22
    public static function getEncryptKey()
23
    {
24
        return (self::MANAGER)::getEncryptKey();
25
    }
26
27
    /**
28
     * @param string $encryptKey
29
     */
30
    public static function setEncryptKey($encryptKey)
31
    {
32
        (self::MANAGER)::setEncryptKey($encryptKey);
33
    }
34
35
    /**
36
     * @param object $object
37
     * @return string
38
     */
39
    protected static function encode($object)
40
    {
41
        return (self::MANAGER)::encrypt(json_encode($object));
42
    }
43
44
    /**
45
     * @param string $string
46
     * @return object
47
     */
48
    protected static function decode($string)
49
    {
50
        return json_decode((self::MANAGER)::decrypt($string));
51
    }
52
}