Acceptable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of Gitamin.
5
 *
6
 * Copyright (C) 2015-2016 The Gitamin Team
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 Gitamin\Http\Middleware;
13
14
use Closure;
15
use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException;
16
17
class Acceptable
18
{
19
    /**
20
     * Handle an incoming request.
21
     *
22
     * @param \Illuminate\Http\Request $request
23
     * @param \Closure                 $next
24
     * @param string                   $type
25
     *
26
     * @return mixed
27
     */
28
    public function handle($request, Closure $next, $type)
29
    {
30
        if (! $request->accepts($type)) {
31
            throw new NotAcceptableHttpException();
32
        }
33
34
        return $next($request);
35
    }
36
}
37