Completed
Push — 1.x ( 59f9af...173ed4 )
by Akihito
17s queued 12s
created

Expiry::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 1
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 $time;
11
12 32
    public function __construct(int $short = 60, int $medium = 3600, int $long = 86400, int $never = 31536000)
13
    {
14 32
        $this->time = [
15 32
            'short' => $short,
16 32
            'medium' => $medium,
17 32
            'long' => $long,
18 32
            'never' => $never,
19 32
        ];
20
    }
21
22
    public function getTime(string $type): int
23
    {
24
        return $this->time[$type];
25
    }
26
}
27