Env::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 10
cc 2
nc 2
nop 2
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config;
6
7
final class Env
8
{
9
    public static function get(string $key, $default = null): callable
10
    {
11
        if (count(func_get_args()) === 2) {
12
            return static fn () => $_ENV[$key] ?? $default;
13
        }
14
15
        return static fn () => $_ENV[$key];
16
    }
17
}
18