Passed
Push — redis ( 437779 )
by Akihito
11:19
created

Expiry::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\QueryRepository;
6
7
final class Expiry
8
{
9
    /** @var array<string, int> */
10
    private array $time;
11
12
    public function __construct(int $short = 60, int $medium = 3600, int $long = 86400, int $never = 31_536_000)
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting ')' on line 12 at column 103
Loading history...
13
    {
14
        $this->time = [
15
            'short' => $short,
16
            'medium' => $medium,
17
            'long' => $long,
18
            'never' => $never,
19
        ];
20
    }
21
22
    public function getTime(string $type): int
23
    {
24
        return $this->time[$type];
25
    }
26
}
27