CustomCommandBusinessFactory::getShellFacade()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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