-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResultDto.php
More file actions
43 lines (36 loc) · 1.03 KB
/
ResultDto.php
File metadata and controls
43 lines (36 loc) · 1.03 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
<?php
namespace Cleantalk\PHPAntiCrawler;
class ResultDto
{
/** @var bool */
public $goodRequest;
/** @var string */
public $status;
public const STATUS_DB_MATCH = 'DB_MATCH';
public const STATUS_FLOOD_PROTECTION = 'FLOOD_PROTECTION';
public const STATUS_BOT_PROTECTION = 'BOT_PROTECTION';
public const STATUS_PERSONAL_LIST_MATCH = 'PERSONAL_LIST_MATCH';
public const STATUS_DENY_SFW = 'DENY_SFW';
public const STATUS_UNDEFINED = ''; // Should not be sent to DB
public function __construct(
bool $goodRequest,
string $status
) {
$this->goodRequest = $goodRequest;
$this->status = $status;
}
public static function fromArray(array $data): self
{
return new self(
$data['good_request'],
$data['status'],
);
}
public function toArray(): array
{
return [
'good_request' => $this->goodRequest,
'status' => $this->status,
];
}
}