Completed
Push — master ( befd33...fb931c )
by Pascal
01:10
created

Lock::getLockedAt()   A

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
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Itkg\DelayEventBundle\Model;
4
5
/**
6
 * Class Lock
7
 */
8
class Lock
9
{
10
    /**
11
     * @var bool
12
     */
13
    protected $commandLocked = false;
14
15
    /**
16
     * @var string
17
     */
18
    protected $channel = '';
19
20
    /**
21
     * @var \DateTime
22
     */
23
    protected $lockedAt;
24
25
    /**
26
     * @return boolean
27
     */
28
    public function isCommandLocked()
29
    {
30
        return $this->commandLocked;
31
    }
32
33
    /**
34
     * @param boolean $commandLocked
35
     *
36
     * @return $this
37
     */
38
    public function setCommandLocked($commandLocked)
39
    {
40
        $this->commandLocked = $commandLocked;
41
42
        if ($commandLocked) {
43
            $this->lockedAt = new \DateTime();
44
        } else {
45
            $this->lockedAt = null;
46
        }
47
        return $this;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getChannel()
54
    {
55
        return $this->channel;
56
    }
57
58
    /**
59
     * @param string $channel
60
     *
61
     * @return Lock
62
     */
63
    public function setChannel($channel)
64
    {
65
        $this->channel = $channel;
66
67
        return $this;
68
    }
69
70
    /**
71
     * @return \DateTime
72
     */
73
    public function getLockedAt()
74
    {
75
        return $this->lockedAt;
76
    }
77
}
78