Completed
Push — develop ( 335c93...e4583a )
by Mohamed
12:58
created

VerifyAjaxRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tinyissue\Http\Middleware;
13
14
use Closure;
15
use Illuminate\Http\Request;
16
17
/**
18
 * VerifyAjaxRequest is a Middleware class to limit request to Ajax call only.
19
 *
20
 * @author Mohamed Alsharaf <[email protected]>
21
 */
22
class VerifyAjaxRequest
23
{
24
    /**
25
     * Handle an incoming request.
26
     *
27
     * @param Request $request
28
     * @param Closure $next
29
     *
30
     * @return mixed
31
     */
32 12
    public function handle(Request $request, Closure $next)
33
    {
34 12
        if (!$request->ajax()) {
35 1
            return response('Not found', 404);
36
        }
37
38 11
        return $next($request);
39
    }
40
}
41