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

Limiter::isExceeded()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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