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

CustomCommandFacade   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 22.22%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 0
loc 37
ccs 2
cts 9
cp 0.2222
rs 10
c 0
b 0
f 0

3 Methods

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