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

IgnitionConfigValueEnabled::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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