Passed
Push — master ( 39dd55...cb4ea4 )
by Mikael
02:08
created

DIFactoryConfig   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 88.89%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
ccs 8
cts 9
cp 0.8889
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 4
1
<?php
2
3
namespace Anax\DI;
4
5
use \Anax\Configure\ConfigureInterface;
6
use \Anax\Configure\ConfigureTrait;
7
8
/**
9
 * DI factory class creating a set of default services by loading
10
 * * them from a configuration file.
11
 */
12
class DIFactoryConfig extends DI implements ConfigureInterface
13
{
14
    use ConfigureTrait;
15
16
17
18
   /**
19
     * Constructor creating a set of services included into this DI container.
20
     */
21 2
    public function __construct($configFile)
22
    {
23 2
        $this->configure($configFile);
24 2
        foreach ($this->config["services"] as $name => $service) {
25 2
            if (isset($service["shared"]) && $service["shared"]) {
26 2
                $this->setShared($name, $service["callback"]);
27 2
            } else {
28
                $this->set($name, $service["callback"]);
29
            }
30 2
        }
31 2
    }
32
}
33