Completed
Pull Request — master (#3)
by
unknown
13:24
created

SimpleCache   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 44
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getEncryptKey() 0 4 1
A setEncryptKey() 0 4 1
A setCacheDirectory() 0 4 1
A encode() 0 4 1
A decode() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: jaredchu
5
 * Date: 09/08/2017
6
 * Time: 16:22
7
 */
8
9
namespace JC\Cache;
10
11
/**
12
 * Class EncryptCache
13
 * @package JC
14
 */
15
class SimpleCache extends BaseCache
16
{
17
    /**
18
     * @return string
19
     */
20
    public static function getEncryptKey()
21
    {
22
        return Manager::getEncryptKey();
23
    }
24
25
    /**
26
     * @param string $encryptKey
27
     */
28
    public static function setEncryptKey($encryptKey)
29
    {
30
        Manager::setEncryptKey($encryptKey);
31
    }
32
33
    /**
34
     * @param string $cacheDirectory
35
     */
36
    public static function setCacheDirectory($cacheDirectory) {
37
        self::$cacheDirectory = $cacheDirectory;
38
        Manager::setCacheDirectory($cacheDirectory);
39
    }
40
41
    /**
42
     * @param object $object
43
     * @return string
44
     */
45
    protected static function encode($object)
46
    {
47
        return Manager::encrypt(json_encode($object));
48
    }
49
50
    /**
51
     * @param string $string
52
     * @return object
53
     */
54
    protected static function decode($string)
55
    {
56
        return json_decode(Manager::decrypt($string));
57
    }
58
}
59