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

Lock::getLockedBy()   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 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