Completed
Pull Request — 1.x (#85)
by Akihito
02:09 queued 51s
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
use ArrayObject;
8
9
final class Expiry
10
{
11
    /**
12 32
     * @var array<string, int>
13
     */
14 32
    private $time;
15 32
16 32
    public function __construct(int $short = 60, int $medium = 3600, int $long = 86400, int $never = 31536000)
17 32
    {
18 32
        $this->time = [
19 32
            'short' => $short,
20
            'medium' => $medium,
21
            'long' => $long,
22
            'never' => $never
23
        ];
24
    }
25
26
    public function getTime(string $type): int
27
    {
28
        return $this->time[$type];
29
    }
30
}
31