Dummy   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 50
c 0
b 0
f 0
ccs 12
cts 12
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 8 2
A set() 0 6 1
A remove() 0 10 2
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2014, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace AnimeDb\Bundle\CacheTimeKeeperBundle\Service\Driver;
11
12
class Dummy extends BaseDriver
13
{
14
    /**
15
     * @var array
16
     */
17
    protected $times = [];
18
19
    /**
20
     * @param string $key
21
     *
22
     * @return \DateTime|null
23
     */
24 4
    public function get($key)
25
    {
26 4
        if (isset($this->times[$key])) {
27 2
            return clone $this->times[$key];
28
        }
29
30 2
        return;
31
    }
32
33
    /**
34
     * @param string $key
35
     * @param \DateTime $time
36
     *
37
     * @return bool
38
     */
39 4
    public function set($key, \DateTime $time)
40
    {
41 4
        $this->times[$key] = clone $time;
42
43 4
        return true;
44
    }
45
46
    /**
47
     * @param string $key
48
     *
49
     * @return bool
50
     */
51 2
    public function remove($key)
52
    {
53 2
        if (isset($this->times[$key])) {
54 1
            unset($this->times[$key]);
55
56 1
            return true;
57
        }
58
59 1
        return false;
60
    }
61
}
62