-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathAbuse.php
More file actions
68 lines (61 loc) · 1.21 KB
/
Abuse.php
File metadata and controls
68 lines (61 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
namespace Utopia\Abuse;
class Abuse
{
/**
* @var Adapter
*/
protected Adapter $adapter;
/**
* @param Adapter $adapter
*/
public function __construct(Adapter $adapter)
{
$this->adapter = $adapter;
}
/**
* Check
*
* Checks if request is considered abuse or not
*
* @return bool
*/
public function check(): bool
{
return $this->adapter->check();
}
/**
* Get abuse logs
*
* Return logs with an offset and limit
*
* @param int|null $offset
* @param int|null $limit
* @return array<string, mixed>
*/
public function getLogs(?int $offset = null, ?int $limit = 25): array
{
return $this->adapter->getLogs($offset, $limit);
}
/**
* Delete all logs older than $timestamp
*
* @param int $timestamp
* @return bool
*/
public function cleanup(int $timestamp): bool
{
return $this->adapter->cleanup($timestamp);
}
/**
* Reset
*
* Reset the count to 0 for the current adapter
*
* @return void
*/
public function reset(): void
{
$this->adapter->reset();
}
}