UseDifferentConfigIfE2E::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 10
cc 2
nc 2
nop 2
crap 2.0625
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