Passed
Push — master ( 590054...70801a )
by Shiyu
01:45
created

conf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * Commands kit
4
 * User: moyo
5
 * Date: 13/10/2017
6
 * Time: 6:33 PM
7
 */
8
9
namespace Carno\Config;
10
11
/**
12
 * default config scope should be server name of detected
13
 * you can also assigned to others e.g. "global" "biz1"
14
 * @param string $scope
15
 * @return Config
16
 */
17
function conf(string $scope = '_') : Config
18
{
19
    static $sources = [];
20
    return $sources[$scope] ?? $sources[$scope] = (new Config())->assigned($scope);
21
}
22