Passed
Push — master ( bc446e...975bfb )
by Alexander
12:44
created

Env::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 2
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