Completed
Pull Request — master (#41)
by Pascal
05:26
created

Lock   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 71
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 71
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 12 2
A getChannel() 0 4 1
A setChannel() 0 6 1
A getLockedBy() 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 string
22
     */
23
    protected $lockedBy;
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->lockedBy = php_uname('n');
44
        } else {
45
            $this->lockedBy = '';
46
        }
47
48
        return $this;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getChannel()
55
    {
56
        return $this->channel;
57
    }
58
59
    /**
60
     * @param string $channel
61
     *
62
     * @return Lock
63
     */
64
    public function setChannel($channel)
65
    {
66
        $this->channel = $channel;
67
68
        return $this;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getLockedBy()
75
    {
76
        return $this->lockedBy;
77
    }
78
}
79