Test Setup Failed
Push — master ( 8c5f4b...dcf915 )
by Alexpts
03:11
created

Limiter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 35
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace PTS\RateLimiter;
5
6
class Limiter
7
{
8
    protected StoreInterface $store;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
9
10
    public function __construct(StoreInterface $store)
11 9
    {
12
        $this->store = $store;
13 9
    }
14 9
15
    public function get(string $key): int
16 5
    {
17
        return $this->store->get($key);
18 5
    }
19
20
    public function inc(string $key, int $ttl = 60): int
21 8
    {
22
        return $this->store->inc($key, $ttl);
23 8
    }
24
25
    public function reset(string $key): bool
26 5
    {
27
        return $this->store->reset($key);
28 5
    }
29
30
    public function isExceeded(string $key, int $max): bool
31 5
    {
32
        return $this->store->isExceeded($key, $max);
33 5
    }
34
35
    public function ttl(string $key): ?int
36 1
    {
37
        return $this->store->ttl($key);
38 1
    }
39
}
40