Completed
Pull Request — master (#1)
by Agaletskiy
04:38 queued 01:44
created

RateLimit   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 44
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getMilliseconds() 0 3 1
A getKey() 0 3 1
A getLimit() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lamoda\Tactician\RateLimit\RateLimiter;
6
7
final class RateLimit
8
{
9
    /**
10
     * @var string
11
     */
12
    private $key;
13
    /**
14
     * @var int
15
     */
16
    private $limit;
17
    /**
18
     * @var int
19
     */
20
    private $milliseconds;
21
22 3
    public function __construct(string $key, int $limit, int $milliseconds)
23
    {
24 3
        $this->key = $key;
25 3
        $this->limit = $limit;
26 3
        $this->milliseconds = $milliseconds;
27 3
    }
28
29
    /**
30
     * @return string
31
     */
32 2
    public function getKey(): string
33
    {
34 2
        return $this->key;
35
    }
36
37
    /**
38
     * @return int
39
     */
40 2
    public function getLimit(): int
41
    {
42 2
        return $this->limit;
43
    }
44
45
    /**
46
     * @return int
47
     */
48 2
    public function getMilliseconds(): int
49
    {
50 2
        return $this->milliseconds;
51
    }
52
}
53