Completed
Pull Request — 1.x (#85)
by Akihito
03:17 queued 01:43
created

Expiry::getTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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