Total Complexity | 4 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 88.89% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class RedisRateLimiter extends BaseRateLimiter |
||
9 | { |
||
10 | /** |
||
11 | * @var string $hostname |
||
12 | */ |
||
13 | public $hostname = 'localhost'; |
||
14 | |||
15 | /** |
||
16 | * @var int $port |
||
17 | */ |
||
18 | public $port = 6379; |
||
19 | |||
20 | /** |
||
21 | * @var string $password |
||
22 | */ |
||
23 | public $password = ''; |
||
24 | |||
25 | public $ttl = 3600; |
||
26 | |||
27 | public $prefix = 'rate_limiter:'; |
||
28 | |||
29 | 2 | protected function initManager(): ManagerInterface |
|
30 | { |
||
31 | 2 | return new RedisManager($this->capacity, $this->rate, $this->getLogger(), $this->getRedis(), $this->ttl, $this->prefix); |
|
32 | } |
||
33 | |||
34 | private $redis; |
||
35 | |||
36 | 2 | protected function getRedis(): \Redis |
|
47 | } |
||
48 | } |
||
49 |