Completed
Push — master ( cc84b4...34fefe )
by Sébastien
03:30
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 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