Issues (78)

src/Services/ThrottleRequestsService.php (4 issues)

1
<?php
2
3
namespace Ikechukwukalu\Requirepin\Services;
4
5
use Illuminate\Foundation\Auth\AuthenticatesUsers;
6
use Illuminate\Http\Request;
7
8
class ThrottleRequestsService {
9
    use AuthenticatesUsers;
0 ignored issues
show
The trait Illuminate\Foundation\Auth\AuthenticatesUsers requires some properties which are not provided by Ikechukwukalu\Requirepin...ThrottleRequestsService: $redirectTo, $decayMinutes
Loading history...
10
11
    public $maxAttempts = 5; // change to the max attempt you want.
12
    public $delayMinutes = 1;
13
14
    public function __construct(int $maxAttempts = 5, int $delayMinutes = 1)
15
    {
16
        $this->maxAttempts = $maxAttempts;
17
        $this->delayMinutes = $delayMinutes;
18
    }
19
20
    public function hasTooManyAttempts (Request $request)
21
    {
22
        return $this->hasTooManyLoginAttempts($request);
23
    }
24
25
    public function incrementAttempts (Request $request)
26
    {
27
        return $this->incrementLoginAttempts($request);
0 ignored issues
show
Are you sure the usage of $this->incrementLoginAttempts($request) targeting Ikechukwukalu\Requirepin...ncrementLoginAttempts() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
28
    }
29
30
    public function clearAttempts (Request $request)
31
    {
32
        return $this->clearLoginAttempts($request);
0 ignored issues
show
Are you sure the usage of $this->clearLoginAttempts($request) targeting Ikechukwukalu\Requirepin...e::clearLoginAttempts() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
33
    }
34
35
    public function _fireLockoutEvent (Request $request)
36
    {
37
        return $this->fireLockoutEvent($request);
0 ignored issues
show
Are you sure the usage of $this->fireLockoutEvent($request) targeting Ikechukwukalu\Requirepin...ice::fireLockoutEvent() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
38
    }
39
40
    public function _limiter ()
41
    {
42
        return $this->limiter();
43
    }
44
45
    public function _throttleKey (Request $request)
46
    {
47
        return $this->throttleKey($request);
48
    }
49
}
50