CommandBuilderFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 19
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 4
1
<?php
2
/**
3
 * This file is part of RoboSystemService.
4
 *
5
 * @author      Aitor García Martínez (Falc) <[email protected]>
6
 * @copyright   2015 Aitor García Martínez (Falc) <[email protected]>
7
 *
8
 * @author      Polyvaniy Oleksii (alexndlm) <[email protected]>
9
 * @copyright   2016 Polyvaniy Oleksii (alexndlm) <[email protected]>
10
 *
11
 * @license     MIT
12
 */
13
14
namespace Falc\Robo\Service\Factory;
15
16
use Falc\Robo\Service\CommandBuilder;
17
18
/**
19
 * CommandBuilder factory.
20
 */
21
class CommandBuilderFactory implements CommandBuilderFactoryInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26 4
    public function create($serviceManager)
27
    {
28
        switch ($serviceManager) {
29 4
            case 'systemd':
30 1
                return new CommandBuilder\SystemdCommandBuilder();
31 3
            case 'sysvinit-debian':
32 1
                return new CommandBuilder\SysVinitDebianCommandBuilder();
33 2
            case 'sysvinit-redhat':
34 1
                return new CommandBuilder\SysVinitRedHatCommandBuilder();
35 1
            default:
36 1
                throw new \InvalidArgumentException('Not supported');
37 1
        }
38
    }
39
}
40