DnfCommandBuilder::getCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
crap 1
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\CommandBuilder;
11
12
/**
13
 * Dnf command builder.
14
 */
15
class DnfCommandBuilder extends YumCommandBuilder
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 9
    public function getCommand()
21
    {
22 9
        $packages = implode(' ', array_unique($this->packages));
23 9
        $options = implode(' ', array_unique($this->options));
24
25 9
        $command = "dnf {$options} {$this->action} {$packages}";
26
27
        // Remove extra whitespaces
28 9
        $command = preg_replace('/\s+/', ' ', trim($command));
29
30 9
        return $command;
31
    }
32
}
33