Passed
Push — master ( 3376db...1497f5 )
by Mike
12:25
created

DynamicModulesFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 26
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createHydrator() 0 6 1
A createFinder() 0 8 1
1
<?php
2
3
4
namespace Nexus\DynamicModules;
5
6
7
use Nexus\DynamicModules\Business\Finder\ModuleFinder;
8
use Nexus\DynamicModules\Business\Finder\CommandFinderInterface;
9
use Nexus\DynamicModules\Business\Finder\ModuleFinderInterface;
10
use Nexus\DynamicModules\Business\Hydrator\CommandHydrator;
11
use Xervice\Core\Factory\AbstractFactory;
12
13
/**
14
 * @method \Nexus\DynamicModules\DynamicModulesConfig getConfig()
15
 */
16
class DynamicModulesFactory extends AbstractFactory
17
{
18
    /**
19
     * @return \Nexus\DynamicModules\Business\Hydrator\CommandHydrator
20
     * @throws \Xervice\Config\Exception\ConfigNotFound
21
     */
22
    public function createHydrator()
23
    {
24
        return new CommandHydrator(
25
            $this->createFinder()
26
        );
27
    }
28
29
    /**
30
     * @return \Nexus\DynamicModules\Business\Finder\ModuleFinder
31
     * @throws \Xervice\Config\Exception\ConfigNotFound
32
     */
33
    public function createFinder() : ModuleFinderInterface
34
    {
35
        return new ModuleFinder(
36
            $this->getConfig()->getApplicationPath(),
37
            $this->getConfig()->getCommandProviderFilter(),
38
            $this->getConfig()->getNamespaces()
39
        );
40
    }
41
}