Completed
Push — master ( 34fefe...4d65b3 )
by Sébastien
03:46
created

CommandRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 81.82%

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 9
cts 11
cp 0.8182
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 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 4
    public function __construct()
14
    {
15 4
        $this->commands = [
16 4
            'pjbserver:start' => new Command\PjbServerStartCommand(),
17 4
            'pjbserver:restart' => new Command\PjbServerRestartCommand(),
18 4
            'pjbserver:stop' => new Command\PjbServerStopCommand()
19 4
        ];
20 4
    }
21
22
    /**
23
     * @param $name
24
     * @return \Symfony\Component\Console\Command\Command
25
     */
26 4
    public function getRegisteredCommand($name)
27
    {
28 4
        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