Completed
Push — add_lock_to_statemachine ( 571155 )
by Oliver
02:16
created

NullMutex::acquireLock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Metabor\Semaphore;
4
5
use MetaborStd\Semaphore\MutexInterface;
6
7
class NullMutex implements MutexInterface
8
{
9
    /**
10
     * @var bool
11
     */
12
    private $acquired = false;
13
14
    /**
15
     * @see \MetaborStd\Semaphore\MutexInterface::releaseLock()
16
     */
17
    public function releaseLock()
18
    {
19
        $this->acquired = false;
20
21
        return true;
22
    }
23
24
    /**
25
     * @see \MetaborStd\Semaphore\MutexInterface::isAcquired()
26
     */
27
    public function isAcquired()
28
    {
29
        return $this->acquired;
30
    }
31
32
    /**
33
     * @see \MetaborStd\Semaphore\MutexInterface::acquireLock()
34
     */
35
    public function acquireLock()
36
    {
37
        $this->acquired = true;
38
39
        return true;
40
    }
41
42
    /**
43
     * @see \MetaborStd\Semaphore\MutexInterface::isLocked()
44
     */
45
    public function isLocked()
46
    {
47
        return false;
48
    }
49
}
50