Passed
Branch master (7315b7)
by Scott
02:53
created

DesmondNamespace   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 31
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setRoot() 0 4 1
A getRoot() 0 4 1
A create() 0 5 1
A get() 0 4 1
A exists() 0 4 1
1
<?php
2
namespace Desmond;
3
4
class DesmondNamespace
5
{
6
    private static $root;
7
    private static $namespaces = [];
8
9 287
    public static function setRoot(Environment $env)
10
    {
11 287
        self::$root = $env;
12 287
    }
13
14 2
    public static function getRoot()
15
    {
16 2
        return self::$root;
17
    }
18
19 6
    public static function create($key, Environment $env)
20
    {
21 6
        self::$root->set($key, $env);
22 6
        self::$namespaces[$key] = $env;
23 6
    }
24
25 7
    public static function get($key)
26
    {
27 7
        return self::$namespaces[$key];
28
    }
29
30 14
    public static function exists($key)
31
    {
32 14
        return array_key_exists($key, self::$namespaces);
33
    }
34
}
35