Completed
Push — master ( 651fd6...ce8064 )
by Sébastien
04:02
created

CommandRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 9.4285
cc 1
eloc 7
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 7
    public function __construct()
14
    {
15 7
        $this->commands = [
16 7
            'pjbserver:start' => new Command\PjbServerStartCommand(),
17 7
            'pjbserver:restart' => new Command\PjbServerRestartCommand(),
18 7
            'pjbserver:stop' => new Command\PjbServerStopCommand(),
19 7
            'pjbserver:status' => new Command\PjbServerStatusCommand(),
20 7
            'pjbserver:reveal' => new Command\PjbServerRevealCommand()
21 7
        ];
22 7
    }
23
24
    /**
25
     * @param $name
26
     * @return \Symfony\Component\Console\Command\Command
27
     */
28 7
    public function getRegisteredCommand($name)
29
    {
30 7
        return $this->commands[$name];
31
    }
32
33
    /**
34
     * Return all registered commands
35
     * @return array
36
     */
37
    public function getRegisteredCommands()
38
    {
39
        return $this->commands;
40
    }
41
}
42