transients->get($key); $start = is_array($bucket) ? (int) ($bucket['start'] ?? 0) : 0; $hits = is_array($bucket) ? (int) ($bucket['hits'] ?? 0) : 0; if ($start + self::WINDOW <= $now) { $start = $now; $hits = 0; } $hits++; $this->transients->set( $key, ['start' => $start, 'hits' => $hits], max(1, ($start + self::WINDOW) - $now) ); return $hits <= self::ALLOWED; } }