Psr11   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 35
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A environment() 0 14 2
A container() 0 7 2
1
<?php
2
3
namespace RestTemplate;
4
5
use ByJG\Config\Definition;
6
7
class Psr11
8
{
9
    private static $definition = null;
10
    private static $container = null;
11
12
    /**
13
     * @return \ByJG\Config\Container
14
     */
15
    public static function container()
16
    {
17
        if (is_null(self::$container)) {
18
            self::$container = self::environment()->build();
19
        }
20
21
        return self::$container;
22
    }
23
24
25
    /**
26
     * @return Definition
27
     */
28
    public static function environment()
29
    {
30
        if (is_null(self::$definition)) {
31
            self::$definition = (new Definition())
32
                ->addEnvironment('dev')
33
                ->addEnvironment('homolog')
34
                    ->inheritFrom('dev')
35
                ->addEnvironment('live')
36
                    ->inheritFrom('homolog')
37
                    ->inheritFrom('dev');
38
            // ->setCache($somePsr16Implementation); // This will cache the result;
39
        }
40
41
        return self::$definition;
42
    }
43
}
44