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

CommandRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

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