CustomCommandFacade   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 22.22%

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 33
ccs 2
cts 9
cp 0.2222
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommands() 0 6 1
A hydrateCommands() 0 3 1
A runShell() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexus\CustomCommand\Business;
5
6
use Xervice\Core\Business\Model\Facade\AbstractFacade;
7
8
/**
9
 * @method \Nexus\CustomCommand\Business\CustomCommandBusinessFactory getFactory()
10
 * @method \Nexus\CustomCommand\CustomCommandConfig getConfig()
11
 */
12
class CustomCommandFacade extends AbstractFacade implements CustomCommandFacadeInterface
13
{
14
    /**
15
     * @param array $commands
16
     * @param string $directory
17
     * @param bool $recursive
18
     *
19
     * @return array
20
     */
21 3
    public function hydrateCommands(array $commands, string $directory, bool $recursive): array
22
    {
23 3
        return $this->getFactory()->createCommandHydrator($directory, $recursive)->hydrateCommands($commands);
24
    }
25
26
    /**
27
     * @param string $command
28
     *
29
     * @return string
30
     */
31
    public function runShell(string $command) : string
32
    {
33
        return $this->getFactory()->getShellFacade()->runCommand($command);
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getCommands(): array
40
    {
41
        return $this->hydrateCommands(
42
            [],
43
            $this->getConfig()->getCommandPath(),
44
            true
45
        );
46
    }
47
}