Completed
Pull Request — master (#39)
by Daniel
04:05
created

ConsoleFacade   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 32
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getCommands() 0 3 1
A addCommand() 0 5 1
1
<?php
2
3
namespace Jellyfish\Console;
4
5
use Symfony\Component\Console\Command\Command;
6
7
class ConsoleFacade implements ConsoleFacadeInterface
8
{
9
    /**
10
     * @var \Jellyfish\Console\ConsoleFactory
11
     */
12
    protected $factory;
13
14
    /**
15
     * @param \Jellyfish\Console\ConsoleFactory $factory
16
     */
17
    public function __construct(ConsoleFactory $factory)
18
    {
19
        $this->factory = $factory;
20
    }
21
22
    /**
23
     * @param \Symfony\Component\Console\Command\Command $command
24
     * @return \Jellyfish\Console\ConsoleFacadeInterface
25
     */
26
    public function addCommand(Command $command): ConsoleFacadeInterface
27
    {
28
        $this->factory->getCommandList()->append($command);
29
30
        return $this;
31
    }
32
33
    /**
34
     * @return \Symfony\Component\Console\Command\Command[]
35
     */
36
    public function getCommands(): array
37
    {
38
        return $this->factory->getCommandList()->getArrayCopy();
39
    }
40
}
41