RedirectIfInstalled::alreadyInstalled()   A
last analyzed

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 0
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Closure;
6
7
class RedirectIfInstalled
8
{
9
    /**
10
     * Handle an incoming request.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @param  \Closure  $next
14
     * @return mixed
15
     */
16 View Code Duplication
    public function handle($request, Closure $next)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18
        if($this->alreadyInstalled() || !config('kleis.installer')) {
19
            return redirect('/');
20
        }
21
22
        return $next($request);
23
    }
24
25
    /**
26
     * If application is already installed.
27
     *
28
     * @return bool
29
     */
30
    public function alreadyInstalled()
31
    {
32
        return file_exists(storage_path('installed'));
33
    }
34
}
35