config::reset()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Ariadne Component Library.
5
 *
6
 * (c) Muze <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace arc;
13
14
/**
15
 * @requires \arc\path
16
 * @requires \arc\tree
17
 * @requires \arc\context
18
*/
19
class config
20
{
21 6
    public static function getConfiguration()
22
    {
23 6
        $context = \arc\context::$context;
24 6
        if (!$context->arcConfig) {
25 2
            $context->arcConfig = new config\Configuration( \arc\tree::expand()->cd( $context->arcPath ) );
26
        }
27
28 6
        return $context->arcConfig;
29
    }
30
31 2
    public static function acquire($name, $path = null, $root = '/')
32
    {
33 2
        return self::getConfiguration()->acquire( $name, $path, $root );
34
    }
35
36 2
    public static function configure($name, $value)
37
    {
38 2
        return self::getConfiguration()->configure( $name, $value );
39
    }
40
41 4
    public static function cd($path)
42
    {
43 4
        return self::getConfiguration()->cd( $path );
44
    }
45
46
    public static function reset($config = null) {
47
        $context = \arc\context::$context;
48
        $config = new \arc\config\Configuration( 
49
            \arc\tree\expand($config)
50
            ->cd( $context->arcPath ) 
51
        );
52
        $context->push( [ 'arcConfig' => $config ] );
53
    }
54
}
55