CommandBuilderFactory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 0
cbo 4
dl 0
loc 21
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B create() 0 15 5
1
<?php
2
/**
3
 * This file is part of RoboSystemPackage.
4
 *
5
 * @author      Aitor García Martínez (Falc) <[email protected]>
6
 * @copyright   2015 Aitor García Martínez (Falc) <[email protected]>
7
 * @license     MIT
8
 */
9
10
namespace Falc\Robo\Package\Factory;
11
12
use Falc\Robo\Package\CommandBuilder;
13
14
/**
15
 * CommandBuilder factory.
16
 */
17
class CommandBuilderFactory implements CommandBuilderFactoryInterface
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 5
    public function create($packageManager)
23
    {
24
        switch ($packageManager) {
25 5
            case 'apt':
26 1
                return new CommandBuilder\AptCommandBuilder();
27 4
            case 'dnf':
28 1
                return new CommandBuilder\DnfCommandBuilder();
29 3
            case 'pacman':
30 1
                return new CommandBuilder\PacmanCommandBuilder();
31 2
            case 'yum':
32 1
                return new CommandBuilder\YumCommandBuilder();
33
            default:
34 1
                throw new \Exception('Not supported');
35
        }
36
    }
37
}
38