Code Duplication    Length = 12-12 lines in 2 locations

src/MemcachedRateLimiter.php 1 location

@@ 24-35 (lines=12) @@
21
        $this->keyPrefix = $keyPrefix;
22
    }
23
24
    public function limit(string $identifier, Rate $rate): void
25
    {
26
        $key = $this->key($identifier, $rate->getInterval());
27
28
        $current = $this->getCurrent($key);
29
30
        if ($current >= $rate->getOperations()) {
31
            throw LimitExceeded::for($identifier, $rate);
32
        }
33
34
        $this->updateCounter($key, $rate->getInterval());
35
    }
36
37
    public function limitSilently(string $identifier, Rate $rate): Status
38
    {

src/RedisRateLimiter.php 1 location

@@ 24-35 (lines=12) @@
21
        $this->keyPrefix = $keyPrefix;
22
    }
23
24
    public function limit(string $identifier, Rate $rate): void
25
    {
26
        $key = $this->key($identifier, $rate->getInterval());
27
28
        $current = $this->getCurrent($key);
29
30
        if ($current >= $rate->getOperations()) {
31
            throw LimitExceeded::for($identifier, $rate);
32
        }
33
34
        $this->updateCounter($key, $rate->getInterval());
35
    }
36
37
    public function limitSilently(string $identifier, Rate $rate): Status
38
    {