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

CommandRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 4
dl 0
loc 36
ccs 10
cts 12
cp 0.8333
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 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 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