Completed
Pull Request — master (#440)
by Alejandro
17:40 queued 14:38
created

LockedCommandConfig::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\CLI\Command\Util;
5
6
final class LockedCommandConfig
7
{
8
    private const DEFAULT_TTL = 90.0; // 1.5 minutes
9
10
    /** @var string */
11
    private $lockName;
12
    /** @var bool */
13
    private $isBlocking;
14
    /** @var float */
15
    private $ttl;
16
17 11
    public function __construct(string $lockName, bool $isBlocking = false, float $ttl = self::DEFAULT_TTL)
18
    {
19 11
        $this->lockName = $lockName;
20 11
        $this->isBlocking = $isBlocking;
21 11
        $this->ttl = $ttl;
22
    }
23
24 11
    public function lockName(): string
25
    {
26 11
        return $this->lockName;
27
    }
28
29 11
    public function isBlocking(): bool
30
    {
31 11
        return $this->isBlocking;
32
    }
33
34 11
    public function ttl(): float
35
    {
36 11
        return $this->ttl;
37
    }
38
}
39