Passed
Push — master ( 3ee595...6f640c )
by Dan
01:48
created

ContainerFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 35
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createConfigurableContainer() 0 3 1
A createRegistrationOnlyContainer() 0 3 1
A createAutoWireContainer() 0 3 1
1
<?php
2
3
namespace danmurf\DependencyInjection;
4
5
class ContainerFactory
6
{
7
    /**
8
     * Create a new container which requires all services are manually registered.
9
     *
10
     * @return Container
11
     */
12 1
    public static function createRegistrationOnlyContainer()
13
    {
14 1
        return new Container(new RegistrationOnlyServiceLocator());
15
    }
16
17
    /**
18
     * Create a new container which requires services are specified in config.
19
     *
20
     * @param array $config
21
     *
22
     * @return Container
23
     */
24 1
    public function createConfigurableContainer(array $config)
25
    {
26 1
        return new Container(new ConfigurableServiceLocator($config));
27
    }
28
29
    /**
30
     * Create a new container which loads services from the specified config, and
31
     * if they're not included, attempts to load them automatically.
32
     *
33
     * @param array $config
34
     *
35
     * @return Container
36
     */
37 1
    public function createAutoWireContainer(array $config)
38
    {
39 1
        return new Container(new AutoWireServiceLocator($config));
40
    }
41
}
42