Completed
Pull Request — master (#139)
by Tom
01:41 queued 19s
created

IgnitionShareEnabled::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 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 IgnitionShareEnabled
10
{
11
    /** @var IgnitionConfig */
12
    protected $ignitionConfig;
13
14
    public function __construct(IgnitionConfig $ignitionConfig)
15
    {
16
        $this->ignitionConfig = $ignitionConfig;
17
    }
18
19
    /**
20
     * Handle an incoming request.
21
     *
22
     * @param  Request  $request
23
     * @param  Closure  $next
24
     * @return mixed
25
     */
26
    public function handle($request, Closure $next)
27
    {
28
        if (! $this->ignitionConfig->getEnableShareButton()) {
29
            abort(404);
30
        }
31
32
        return $next($request);
33
    }
34
}
35