LoggersFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 29
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getServiceType() 0 4 1
A create() 0 13 3
1
<?php
2
3
namespace ElasticsearchModule\Service;
4
5
use ArrayObject;
6
use Interop\Container\ContainerInterface;
7
8
/**
9
 * @author Pedro Alves <[email protected]>
10
 */
11
class LoggersFactory extends AbstractFactory
12
{
13
    
14
    /**
15
     * {@inheritDoc}
16
     */
17 24
    protected function create(ContainerInterface $container, $config)
18
    {
19 24
        $factories = $config['factories'];
20 24
        $loggers = [];
21
        
22 24
        foreach ($factories as $name => $factory) {
23 24
            if (in_array(AbstractFactory::class, class_parents($factory))) {
24 24
                $factory = new $factory($this->getName());
25 24
                $loggers[$name] = $factory->create($container, $config);
26 24
            }
27 24
        }
28 24
        return new ArrayObject($loggers);
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     */
34 24
    public function getServiceType()
35
    {
36 24
        return 'loggers';
37
    }
38
39
}
40