@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | /** |
232 | 232 | * Check for attacks. |
233 | 233 | * |
234 | - * @param $ipAddress |
|
234 | + * @param null|string $ipAddress |
|
235 | 235 | * |
236 | 236 | * @return bool |
237 | 237 | */ |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | /** |
368 | 368 | * Make the cache key to record countries. |
369 | 369 | * |
370 | - * @param $ipAddress |
|
370 | + * @param string $ipAddress |
|
371 | 371 | * |
372 | 372 | * @return string|null |
373 | 373 | */ |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function checkExpiration() |
111 | 111 | { |
112 | - $this->getEnabledItems()->each(function ($index, $type) { |
|
112 | + $this->getEnabledItems()->each(function($index, $type) { |
|
113 | 113 | if (($this->now()->diffInSeconds($this->record[$type]['lastRequestAt'])) <= ($this->getMaxSecondsForType($type))) { |
114 | 114 | return $this->record; |
115 | 115 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | protected function increment() |
213 | 213 | { |
214 | - $this->getEnabledItems()->each(function ($index, $type) { |
|
214 | + $this->getEnabledItems()->each(function($index, $type) { |
|
215 | 215 | $this->save($type, ['requestCount' => $this->record[$type]['requestCount'] + 1]); |
216 | 216 | }); |
217 | 217 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | protected function isAttack() |
225 | 225 | { |
226 | - return $this->getEnabledItems()->filter(function ($index, $type) { |
|
226 | + return $this->getEnabledItems()->filter(function($index, $type) { |
|
227 | 227 | if (!$this->isWhitelisted($type) && $this->record[$type]['requestCount'] > $this->getMaxRequestCountForType($type)) { |
228 | 228 | $this->takeAction($this->record[$type]); |
229 | 229 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | private function loadConfig() |
282 | 282 | { |
283 | - $this->enabledItems = collect($this->config()->get('attack_blocker.enabled'))->filter(function ($item) { |
|
283 | + $this->enabledItems = collect($this->config()->get('attack_blocker.enabled'))->filter(function($item) { |
|
284 | 284 | return $item === true; |
285 | 285 | }); |
286 | 286 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function loadRecordItems() |
312 | 312 | { |
313 | - $this->getEnabledItems()->each(function ($index, $type) { |
|
313 | + $this->getEnabledItems()->each(function($index, $type) { |
|
314 | 314 | if (is_null($this->record[$type] = $this->cache()->get($key = $this->makeKeyForType($type, $this->ipAddress)))) { |
315 | 315 | $this->record[$type] = $this->getEmptyRecord($key, $type); |
316 | 316 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | if (!$record['wasNotified'] && $this->config()->get('notifications.enabled')) { |
464 | 464 | $this->save($record['type'], ['wasNotified' => true]); |
465 | 465 | |
466 | - collect($this->config()->get('notifications.channels'))->filter(function ($value, $channel) use ($record) { |
|
466 | + collect($this->config()->get('notifications.channels'))->filter(function($value, $channel) use ($record) { |
|
467 | 467 | event(new AttackDetected($record, $channel)); |
468 | 468 | }); |
469 | 469 | } |