Completed
Push — master ( cc84b4...34fefe )
by Sébastien
03:30
created

CommandRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 63.64%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 35
ccs 7
cts 11
cp 0.6364
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getRegisteredCommands() 0 4 1
A getRegisteredCommand() 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 1
    public function __construct()
14
    {
15 1
        $this->commands = [
16 1
            'pjbserver:start' => new Command\PjbServerStartCommand(),
17 1
            'pjbserver:restart' => new Command\PjbServerRestartCommand(),
18 1
            'pjbserver:stop' => new Command\PjbServerStopCommand()
19 1
        ];
20 1
    }
21
22
    /**
23
     * @param $name
24
     * @return \Symfony\Component\Console\Command\Command
25
     */
26
    public function getRegisteredCommand($name)
27
    {
28
        return $this->commands[$name];
29
    }
30
31
    /**
32
     * Return all registered commands
33
     * @return array
34
     */
35
    public function getRegisteredCommands()
36
    {
37
        return $this->commands;
38
    }
39
}
40