Definition::getCommands()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Assimtech\Tempo;
4
5
use Symfony\Component\Console\Command\Command;
6
7
class Definition
8
{
9
    /**
10
     * @var \Symfony\Component\Console\Command\Command[] $commands
11
     */
12
    private $commands;
13
14
    /**
15
     * @param \Symfony\Component\Console\Command\Command[] $commands
16
     */
17 6
    public function __construct(array $commands = array())
18
    {
19 6
        $this->commands = array();
20 6
        $this->addCommands($commands);
21 6
    }
22
23
    /**
24
     * @param \Symfony\Component\Console\Command\Command $command
25
     * @return self
26
     */
27 3
    public function addCommand(Command $command)
28
    {
29 3
        $this->commands[] = $command;
30
31 3
        return $this;
32
    }
33
34
    /**
35
     * @param \Symfony\Component\Console\Command\Command[] $commands
36
     * @return self
37
     */
38 6
    public function addCommands(array $commands)
39
    {
40 6
        foreach ($commands as $command) {
41 2
            $this->addCommand($command);
42 6
        }
43
44 6
        return $this;
45
    }
46
47
    /**
48
     * @return \Symfony\Component\Console\Command\Command[]
49
     */
50 4
    public function getCommands()
51
    {
52 4
        return $this->commands;
53
    }
54
}
55