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

SimpleCache::setCacheDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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