Passed
Push — master ( 5b3043...a2340d )
by butschster
09:28 queued 02:04
created

Verbosity   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 9
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A detect() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Exceptions;
6
7
use Spiral\Boot\EnvironmentInterface;
8
use Spiral\Boot\Injector\InjectableEnumInterface;
9
use Spiral\Boot\Injector\ProvideFrom;
10
11
#[ProvideFrom(method: 'detect')]
12
enum Verbosity: int implements InjectableEnumInterface
13
{
14
    case BASIC = 0;
15
    case VERBOSE = 1;
16
    case DEBUG = 2;
17
18 40
    public static function detect(EnvironmentInterface $environment): self
19
    {
20 40
        return match (\strtolower((string) $environment->get('VERBOSITY_LEVEL'))) {
21 3
            'basic', '0' => self::BASIC,
22 2
            'debug', '2' => self::DEBUG,
23 40
            default => self::VERBOSE
24
        };
25
    }
26
}
27