Completed
Push — master ( 940e51...1d854b )
by Marcel
01:28
created

IgnitionConfigValueEnabled   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 8 2
1
<?php
2
3
namespace Facade\Ignition\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Http\Request;
7
use Facade\Ignition\IgnitionConfig;
8
9
class IgnitionConfigValueEnabled
10
{
11
    /** @var \Facade\Ignition\IgnitionConfig */
12
    protected $ignitionConfig;
13
14
    public function __construct(IgnitionConfig $ignitionConfig)
15
    {
16
        $this->ignitionConfig = $ignitionConfig;
17
    }
18
19
    public function handle(Request $request, Closure $next, string $value)
20
    {
21
        if (! $this->ignitionConfig->toArray()[$value]) {
22
            abort(404);
23
        }
24
25
        return $next($request);
26
    }
27
}
28