|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NicolasBeauvais\LaravelBotScout; |
|
4
|
|
|
|
|
5
|
|
|
use NicolasBeauvais\BotScout\BotScout as BotScoutClient; |
|
6
|
|
|
|
|
7
|
|
|
class BotScout |
|
8
|
|
|
{ |
|
9
|
|
|
/** @var BotScoutClient */ |
|
10
|
|
|
protected $botScoutClient; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* BotScout constructor. |
|
14
|
|
|
* |
|
15
|
|
|
* @param BotScoutClient $client |
|
16
|
|
|
*/ |
|
17
|
|
|
public function __construct(BotScoutClient $client) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->botScoutClient = $client; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Check based on the "multi" method with a failsafe. |
|
24
|
|
|
* |
|
25
|
|
|
* @param string $name |
|
26
|
|
|
* @param string $mail |
|
27
|
|
|
* @param string $ip |
|
28
|
|
|
* |
|
29
|
|
|
* @return bool |
|
30
|
|
|
*/ |
|
31
|
|
|
public function check(string $name = null, string $mail = null, string $ip = null) : bool |
|
32
|
|
|
{ |
|
33
|
|
|
try { |
|
34
|
|
|
return $this->botScoutClient->multi($name, $mail, $ip)->isValid(); |
|
35
|
|
|
} catch (\Exception $exception) { |
|
36
|
|
|
return false; |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Test matches all parameters at once. |
|
42
|
|
|
* |
|
43
|
|
|
* @param string $name |
|
44
|
|
|
* @param string $mail |
|
45
|
|
|
* @param string $ip |
|
46
|
|
|
* |
|
47
|
|
|
* @return \NicolasBeauvais\BotScout\BotScoutResponse |
|
48
|
|
|
*/ |
|
49
|
|
|
public function multi(string $name = null, string $mail = null, string $ip = null) |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->botScoutClient->multi($name, $mail, $ip); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Test matches a single item against all fields in the botscout database. |
|
56
|
|
|
* |
|
57
|
|
|
* @param string $all |
|
58
|
|
|
* |
|
59
|
|
|
* @return \NicolasBeauvais\BotScout\BotScoutResponse |
|
60
|
|
|
*/ |
|
61
|
|
|
public function all(string $all) |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->botScoutClient->all($all); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Test matches a name. |
|
68
|
|
|
* |
|
69
|
|
|
* @param string $name |
|
70
|
|
|
* |
|
71
|
|
|
* @return \NicolasBeauvais\BotScout\BotScoutResponse |
|
72
|
|
|
*/ |
|
73
|
|
|
public function name(string $name = null) |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->botScoutClient->name($name); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Test matches an email. |
|
80
|
|
|
* |
|
81
|
|
|
* @param string $mail |
|
82
|
|
|
* |
|
83
|
|
|
* @return \NicolasBeauvais\BotScout\BotScoutResponse |
|
84
|
|
|
*/ |
|
85
|
|
|
public function mail(string $mail = null) |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->botScoutClient->mail($mail); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Test matches an ip. |
|
92
|
|
|
* |
|
93
|
|
|
* @param string $ip |
|
94
|
|
|
* |
|
95
|
|
|
* @return \NicolasBeauvais\BotScout\BotScoutResponse |
|
96
|
|
|
*/ |
|
97
|
|
|
public function ip(string $ip = null) |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->botScoutClient->ip($ip); |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|