LaravelContextDetector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A detectCurrentContext() 0 8 2
1
<?php
2
3
namespace Facade\Ignition\Context;
4
5
use Facade\FlareClient\Context\ContextDetectorInterface;
6
use Facade\FlareClient\Context\ContextInterface;
7
use Illuminate\Http\Request;
8
9
class LaravelContextDetector implements ContextDetectorInterface
10
{
11
    public function detectCurrentContext(): ContextInterface
12
    {
13
        if (app()->runningInConsole()) {
14
            return new LaravelConsoleContext($_SERVER['argv'] ?? []);
15
        }
16
17
        return new LaravelRequestContext(app(Request::class));
18
    }
19
}
20