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

CommandRepository::getRegisteredCommands()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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