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

CommandRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 84.62%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
c 3
b 0
f 1
lcom 1
cbo 5
dl 0
loc 37
ccs 11
cts 13
cp 0.8462
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getRegisteredCommand() 0 4 1
A getRegisteredCommands() 0 4 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