CustomCommandBusinessFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 38
ccs 9
cts 11
cp 0.8182
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getShellFacade() 0 3 1
A createCommandHydrator() 0 6 1
A createCommandFinder() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexus\CustomCommand\Business;
5
6
use Nexus\CustomCommand\Business\Model\Finder\CommandFinder;
7
use Nexus\CustomCommand\Business\Model\Finder\CommandFinderInterface;
8
use Nexus\CustomCommand\Business\Model\Hydrator\CommandHydrator;
9
use Nexus\CustomCommand\Business\Model\Hydrator\CommandHydratorInterface;
10
use Nexus\CustomCommand\CustomCommandDependencyProvider;
11
use Nexus\Shell\Business\ShellFacade;
12
use Xervice\Core\Business\Model\Factory\AbstractBusinessFactory;
13
14
/**
15
 * @method \Nexus\CustomCommand\CustomCommandConfig getConfig()
16
 */
17
class CustomCommandBusinessFactory extends AbstractBusinessFactory
18
{
19
    /**
20
     * @param string $directory
21
     * @param bool $recursive
22
     *
23
     * @return \Nexus\CustomCommand\Business\Model\Hydrator\CommandHydratorInterface
24
     */
25 3
    public function createCommandHydrator(string $directory, bool $recursive) : CommandHydratorInterface
26
    {
27 3
        return new CommandHydrator(
28 3
            $this->createCommandFinder(
29 3
                $directory,
30 3
                $recursive
31
            )
32
        );
33
    }
34
35
    /**
36
     * @param string $directory
37
     * @param bool $recursive
38
     *
39
     * @return \Nexus\CustomCommand\Business\Model\Finder\CommandFinderInterface
40
     */
41 3
    public function createCommandFinder(string $directory, bool $recursive) : CommandFinderInterface
42
    {
43 3
        return new CommandFinder(
44 3
            $directory,
45 3
            $recursive
46
        );
47
    }
48
49
    /**
50
     * @return \Nexus\Shell\Business\ShellFacade
51
     */
52
    public function getShellFacade(): ShellFacade
53
    {
54
        return $this->getDependency(CustomCommandDependencyProvider::SHELL_FACADE);
55
    }
56
}