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

Lock   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 70
ccs 0
cts 16
cp 0
rs 10
c 1
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isCommandLocked() 0 4 1
A setCommandLocked() 0 11 2
A getChannel() 0 4 1
A setChannel() 0 6 1
A getLockedAt() 0 4 1
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