Passed
Push — master ( abb268...e8f016 )
by IRFA
03:33
created

ApiLockAccount   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 23
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 14 4
1
<?php
2
3
namespace Irfa\Lockout\Middleware;
4
5
use Closure;
6
use Route;
7
use URL;
8
use Lang;
9
use Illuminate\Support\Facades\File;
10
use Irfa\Lockout\Func\Core;
11
12
class ApiLockAccount extends Core
13
{
14
    /**
15
     * Handle an incoming request.
16
     *
17
     * @param  \Illuminate\Http\Request  $request
18
     * @param  \Closure  $next
19
     * @return mixed
20
     */
21
    public function handle($request, Closure $next)
22
    {
23
        if ($request->method() == "POST") {
24
            if (in_array($request->path(), config('irfa.lockout.protected_action_path'))) {
25
                if ($this->lockLogin()) {
26
                    $this->eventFailedLogin();
27
                    $this->logging("API");
28
                    $message['code'] = 403;
0 ignored issues
show
Comprehensibility Best Practice introduced by
$message was never initialized. Although not strictly required by PHP, it is generally a good practice to add $message = array(); before regardless.
Loading history...
29
                    $message[config('irfa.lockout.message_name')] = Lang::get('lockoutMessage.locked');
30
                    return response()->json($message);
31
                }
32
            }
33
        }
34
            return $next($request);
35
    }
36
}
37