Completed
Push — master ( 4456fe...59e4d4 )
by Sébastien
03:55
created

CommandRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 9
ccs 8
cts 8
cp 1
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PjbServer\Tools\Console;
4
5
class CommandRepository
6
{
7
8
    /**
9
     * @var array
10
     */
11
    protected $commands;
12
13 6
    public function __construct()
14
    {
15 6
        $this->commands = [
16 6
            'pjbserver:start' => new Command\PjbServerStartCommand(),
17 6
            'pjbserver:restart' => new Command\PjbServerRestartCommand(),
18 6
            'pjbserver:stop' => new Command\PjbServerStopCommand(),
19 6
            'pjbserver:status' => new Command\PjbServerStatusCommand()
20 6
        ];
21 6
    }
22
23
    /**
24
     * @param $name
25
     * @return \Symfony\Component\Console\Command\Command
26
     */
27 6
    public function getRegisteredCommand($name)
28
    {
29 6
        return $this->commands[$name];
30
    }
31
32
    /**
33
     * Return all registered commands
34
     * @return array
35
     */
36
    public function getRegisteredCommands()
37
    {
38
        return $this->commands;
39
    }
40
}
41