1 | <?php namespace Arcanedev\SpamBlocker\Entities; |
||
11 | class Spammers extends Collection |
||
12 | { |
||
13 | /* ------------------------------------------------------------------------------------------------ |
||
14 | | Main Functions |
||
15 | | ------------------------------------------------------------------------------------------------ |
||
16 | */ |
||
17 | /** |
||
18 | * Load the items. |
||
19 | * |
||
20 | * @param array $spammers |
||
21 | * |
||
22 | * @return static |
||
23 | */ |
||
24 | 232 | public static function load(array $spammers) |
|
28 | 232 | ||
29 | 232 | /** |
|
30 | 174 | * Add many hosts to the blacklist collection. |
|
31 | * |
||
32 | 232 | * @param array $includes |
|
33 | * |
||
34 | * @return self |
||
35 | */ |
||
36 | public function includes(array $includes) |
||
44 | 72 | ||
45 | 56 | /** |
|
46 | 54 | * Add many hosts to the whitelist collection. |
|
47 | * |
||
48 | 72 | * @param array $excludes |
|
49 | * |
||
50 | * @return self |
||
51 | */ |
||
52 | public function excludes(array $excludes) |
||
60 | 72 | ||
61 | 40 | /** |
|
62 | 54 | * Add a host to a blacklist collection. |
|
63 | * |
||
64 | 72 | * @param string $host |
|
65 | * |
||
66 | * @return static |
||
67 | */ |
||
68 | public function blockOne($host) |
||
74 | 264 | ||
75 | /** |
||
76 | 264 | * Add a host to a whitelist collection. |
|
77 | 204 | * |
|
78 | 264 | * @param string $host |
|
79 | * |
||
80 | * @return static |
||
81 | */ |
||
82 | public function allowOne($host) |
||
88 | 64 | ||
89 | /** |
||
90 | 64 | * Add a host to the collection. |
|
91 | 54 | * |
|
92 | 64 | * @param string $host |
|
93 | * @param bool $blocked |
||
94 | * |
||
95 | * @return static |
||
96 | */ |
||
97 | private function addOne($host, $blocked = true) |
||
106 | 280 | ||
107 | 280 | /** |
|
108 | 210 | * Update a host/spammer. |
|
109 | * |
||
110 | 280 | * @param string $host |
|
111 | * @param bool $blocked |
||
112 | * |
||
113 | * @return static |
||
114 | */ |
||
115 | private function updateOne($host, $blocked = true) |
||
127 | |||
128 | 48 | /** |
|
129 | 48 | * Get a spammer from the collection. |
|
130 | * |
||
131 | 48 | * @param string $host |
|
132 | * |
||
133 | * @return array|null |
||
134 | */ |
||
135 | public function getOne($host) |
||
140 | |||
141 | 280 | /** |
|
142 | * Filter the spammer by the given hosts. |
||
143 | 280 | * |
|
144 | 280 | * @param array $hosts |
|
145 | * @param bool $strict |
||
146 | * |
||
147 | * @return static |
||
148 | */ |
||
149 | public function whereHostIn(array $hosts, $strict = false) |
||
157 | |||
158 | /** |
||
159 | * Check if a spammer exists in the collection. |
||
160 | * |
||
161 | * @param string $host |
||
162 | * |
||
163 | * @return bool |
||
164 | */ |
||
165 | public function exists($host) |
||
169 | } |
||
170 |