Lock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A acquire() 0 3 1
A release() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jellyfish\LockSymfony;
6
7
use Jellyfish\Lock\LockInterface;
8
use Symfony\Component\Lock\LockInterface as SymfonyLockInterface;
9
10
class Lock implements LockInterface
11
{
12
    /**
13
     * @var \Symfony\Component\Lock\LockInterface
14
     */
15
    protected $symfonyLock;
16
17
    /**
18
     * @param \Symfony\Component\Lock\LockInterface $symfonyLock
19
     */
20
    public function __construct(SymfonyLockInterface $symfonyLock)
21
    {
22
        $this->symfonyLock = $symfonyLock;
23
    }
24
25
    /**
26
     * @return bool
27
     */
28
    public function acquire(): bool
29
    {
30
        return $this->symfonyLock->acquire();
31
    }
32
33
    /**
34
     * @return \Jellyfish\Lock\LockInterface
35
     */
36
    public function release(): LockInterface
37
    {
38
        $this->symfonyLock->release();
39
40
        return $this;
41
    }
42
}
43