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

DummyLockAdapter::isLocked()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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