Issues (78)

src/Middleware/RequirePin.php (6 issues)

Labels
1
<?php
2
3
namespace Ikechukwukalu\Requirepin\Middleware;
4
5
use Closure;
6
use Ikechukwukalu\Requirepin\Facades\PinService;
7
use Ikechukwukalu\Requirepin\Traits\Helpers;
8
use Illuminate\Http\Request;
9
use Illuminate\Support\Facades\Auth;
10
11
class RequirePin
12
{
13
    use Helpers;
0 ignored issues
show
The trait Ikechukwukalu\Requirepin\Traits\Helpers requires the property $ip which is not provided by Ikechukwukalu\Requirepin\Middleware\RequirePin.
Loading history...
14
15
    public function handle(Request $request, Closure $next)
16
    {
17
        $pinService = new PinService();
18
19
        if (!Auth::guard(config('requirepin.auth_guard', 'web'))->check())
20
        {
21
            return $this->httpResponse(
0 ignored issues
show
The call to Ikechukwukalu\Requirepin...uirePin::httpResponse() has too few arguments starting with status. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
            return $this->/** @scrutinizer ignore-call */ httpResponse(

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
22
                ...$pinService::pinRequestTerminated($request));
0 ignored issues
show
The method pinRequestTerminated() does not exist on Ikechukwukalu\Requirepin\Facades\PinService. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
                ...$pinService::/** @scrutinizer ignore-call */ pinRequestTerminated($request));
Loading history...
23
        }
24
25
        if ($request->has(config('requirepin.param', '_uuid'))
26
            && $pinService::isArrestedRequestValid($request))
0 ignored issues
show
The method isArrestedRequestValid() does not exist on Ikechukwukalu\Requirepin\Facades\PinService. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
            && $pinService::/** @scrutinizer ignore-call */ isArrestedRequestValid($request))
Loading history...
27
        {
28
            return $next($request);
29
        }
30
31
        $pinService::cancelAllOpenArrestedRequests();
0 ignored issues
show
The method cancelAllOpenArrestedRequests() does not exist on Ikechukwukalu\Requirepin\Facades\PinService. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        $pinService::/** @scrutinizer ignore-call */ 
32
                     cancelAllOpenArrestedRequests();
Loading history...
32
33
        return $pinService::requirePinValidationForRequest($request,
0 ignored issues
show
The method requirePinValidationForRequest() does not exist on Ikechukwukalu\Requirepin\Facades\PinService. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        return $pinService::/** @scrutinizer ignore-call */ requirePinValidationForRequest($request,
Loading history...
34
            $this->getUserIp($request));
35
    }
36
37
}
38