Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
loks0n committed Dec 27, 2024
1 parent a9c7993 commit 79c8ce6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Abuse/Adapters/TimeLimit/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Redis extends TimeLimit
* @var \Redis
*/
protected \Redis $redis;

/**
* @var int
*/
Expand Down Expand Up @@ -73,7 +73,7 @@ protected function hit(string $key, int $timestamp): void
->incr($key)
->expire($key, $this->ttl)
->exec();

$this->count = ($this->count ?? 0) + 1;
}

Expand All @@ -91,18 +91,18 @@ public function getLogs(?int $offset = null, ?int $limit = 25): array
$cursor = 0;
$matches = [];
$pattern = self::NAMESPACE . '__*';

do {
/** @var array{0: string|false, 1: array<int, string>} */
$result = $this->redis->scan($cursor, $pattern, $limit);

if ($result === false) {
break;
}

[$newCursor, $keys] = $result;
$cursor = (int)$newCursor;

if (!empty($keys)) {
/** @var array<string|false> */
$values = $this->redis->mget($keys);
Expand Down

0 comments on commit 79c8ce6

Please sign in to comment.