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

DynamicModulesFactory::createFinder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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
}