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

Expiry   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getTime() 0 4 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