From ed30e8a74fa0f34c360fcca2593e3b08b2ce84f0 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 12 Mar 2024 07:51:25 +0000 Subject: [PATCH] fix format --- src/Abuse/Adapters/Redis.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Abuse/Adapters/Redis.php b/src/Abuse/Adapters/Redis.php index e2ebe65..63d162f 100644 --- a/src/Abuse/Adapters/Redis.php +++ b/src/Abuse/Adapters/Redis.php @@ -160,7 +160,7 @@ public function check(): bool public function getLogs(?int $offset = null, ?int $limit = 25): array { // TODO limit potential is SCAN but needs cursor no offset - return $this->redis->keys(self::NAMESPACE . ':*'); + return $this->redis->keys(self::NAMESPACE . ':*'); } /** @@ -172,8 +172,8 @@ public function getLogs(?int $offset = null, ?int $limit = 25): array public function cleanup(string $datetime): bool { // TODO - $iterator = NULL; - while($iterator !== 0) { + $iterator = null; + while ($iterator !== 0) { $keys = $this->redis->scan($iterator, self::NAMESPACE . ':*:*', 1000); $keys = $this->filterKeys($keys, $datetime); $this->redis->del($keys); @@ -181,7 +181,8 @@ public function cleanup(string $datetime): bool return true; } - protected function filterKeys(array $keys, int $timestamp): array { + protected function filterKeys(array $keys, int $timestamp): array + { $filteredKeys = []; foreach ($keys as $key) { $parts = explode(':', $key); @@ -192,6 +193,4 @@ protected function filterKeys(array $keys, int $timestamp): array { } return $filteredKeys; } - - -} \ No newline at end of file +}