UseDifferentConfigIfE2E   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
c 0
b 0
f 0
dl 0
loc 12
ccs 3
cts 4
cp 0.75
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Http\Request;
7
use Illuminate\Support\Arr;
8
9
/**
10
 * Check if the app is running in an E2E session and use the proper data settings.
11
 */
12
class UseDifferentConfigIfE2E
13
{
14
    /**
15
     * @return mixed
16
     */
17 33
    public function handle(Request $request, Closure $next)
18
    {
19 33
        if (Arr::get($_SERVER, 'SERVER_PORT') === '8081') {
20
            config(['database.default' => 'sqlite-e2e']);
21
        }
22
23 33
        return $next($request);
24
    }
25
}
26