CacheManager::save()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
namespace SvImages\Service;
3
4
use SvImages\Cache\StorageInterface;
5
6
/**
7
 * @author Vytautas Stankus <[email protected]>
8
 * @license MIT
9
 */
10
class CacheManager
11
{
12
    /**
13
     * @var StorageInterface
14
     */
15
    protected $storage;
16
17
    /**
18
     * @var bool
19
     */
20
    protected $enabled = false;
21
22
    /**
23
     * @param StorageInterface $storage
24
     */
25
    public function __construct(StorageInterface $storage)
26
    {
27
        $this->storage = $storage;
28
    }
29
30
    public function get($key)
31
    {
32
        return $this->storage->get($key);
33
    }
34
35
    public function save($key, $contents)
36
    {
37
        return $this->storage->set($key, $contents);
38
    }
39
40
    public function has($key)
41
    {
42
        return $this->storage->has($key);
43
    }
44
45
    public function delete($key)
46
    {
47
        return $this->storage->remove($key);
48
    }
49
}
50