Lock::acquire()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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