Test Failed
Push — master ( fdad3b...1a9d53 )
by Mike
07:27
created

CustomCommandFactory::createCommandHydrator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
4
namespace Nexus\CustomCommand;
5
6
7
use Nexus\CustomCommand\Business\Finder\CommandFinder;
8
use Nexus\CustomCommand\Business\Finder\CommandFinderInterface;
9
use Nexus\CustomCommand\Business\Hydrator\CommandHydrator;
10
use Nexus\CustomCommand\Business\Hydrator\CommandHydratorInterface;
11
use Xervice\Core\Factory\AbstractFactory;
12
13
/**
14
 * @method \Nexus\CustomCommand\CustomCommandConfig getConfig()
15
 */
16
class CustomCommandFactory extends AbstractFactory
17
{
18
    /**
19
     * @return \Nexus\CustomCommand\Business\Hydrator\CommandHydrator
20
     */
21 3
    public function createCommandHydrator(string $directory, bool $recursive) : CommandHydratorInterface
22
    {
23 3
        return new CommandHydrator(
24 3
            $this->createCommandFinder(
25 3
                $directory,
26 3
                $recursive
27
            )
28
        );
29
    }
30
31
    /**
32
     * @return \Nexus\CustomCommand\Business\Finder\CommandFinder
33
     */
34 3
    public function createCommandFinder(string $directory, bool $recursive) : CommandFinderInterface
35
    {
36 3
        return new CommandFinder(
37 3
            $directory,
38 3
            $recursive
39
        );
40
    }
41
42
    /**
43
     * @return \Nexus\Shell\ShellFacade
44
     */
45
    public function getShellFacade()
46
    {
47
        return $this->getDependency(CustomCommandDependencyProvider::SHELL_FACADE);
48
    }
49
}