Completed
Push — master ( 94e1e6...1341d4 )
by Alejandro
16s queued 11s
created

LockedCommandConfig::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 3
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
    public function __construct(string $lockName, bool $isBlocking = false, float $ttl = self::DEFAULT_TTL)
18
    {
19
        $this->lockName = $lockName;
20
        $this->isBlocking = $isBlocking;
21
        $this->ttl = $ttl;
22
    }
23
24
    public function lockName(): string
25
    {
26
        return $this->lockName;
27
    }
28
29
    public function isBlocking(): bool
30
    {
31
        return $this->isBlocking;
32
    }
33
34
    public function ttl(): float
35
    {
36
        return $this->ttl;
37
    }
38
}
39