Completed
Push — master ( 83bd2d...9517e2 )
by Arne
03:10
created

DummyLockAdapter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isLocked() 0 4 1
A acquireLock() 0 6 1
A releaseLock() 0 9 2
1
<?php
2
3
namespace Archivr\LockAdapter;
4
5
class DummyLockAdapter extends AbstractLockAdapter
6
{
7
    public function isLocked(string $name): bool
8
    {
9
        return $this->hasLock($name);
10
    }
11
12
    public function acquireLock(string $name): bool
13
    {
14
        $this->acquiredLocks[] = $name;
15
16
        return true;
17
    }
18
19
    public function releaseLock(string $name): bool
20
    {
21
        if ($index = array_search($name, $this->acquiredLocks))
22
        {
23
            unset($this->acquiredLocks[$index]);
24
        }
25
26
        return true;
27
    }
28
}
29