Passed
Push — unit ( fc9abb...3cd14f )
by Luke
02:42
created

CheckoutIndexCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getCommandLine() 0 3 1
A getPrefix() 0 3 1
A setPrefix() 0 3 1
1
<?php
2
3
/**
4
 * Moodle component manager.
5
 *
6
 * @author Luke Carrier <[email protected]>
7
 * @copyright 2016 Luke Carrier
8
 * @license GPL-3.0+
9
 */
10
11
namespace ComponentManager\VersionControl\Git\Command;
12
13
/**
14
 * Initialise a new repository.
15
 */
16
class CheckoutIndexCommand implements Command {
17
    /**
18
     * Prefix.
19
     *
20
     * @var string
21
     */
22
    protected $prefix;
23
24
    /**
25
     * Initialiser.
26
     *
27
     * @param string $prefix
28
     */
29 1
    public function __construct($prefix) {
30 1
        $this->prefix = $prefix;
31 1
    }
32
33
    /**
34
     * @override Command
35
     */
36 1
    public function getCommandLine() {
37 1
        return ['checkout-index', '--all', "--prefix={$this->prefix}"];
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $this instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
38
    }
39
40
    /**
41
     * Get the prefix.
42
     *
43
     * @return string
44
     *
45
     * @codeCoverageIgnore
46
     */
47
    public function getPrefix() {
48
        return $this->prefix;
49
    }
50
51
    /**
52
     * Set the prefix.
53
     *
54
     * @param string $prefix
55
     *
56
     * @codeCoverageIgnore
57
     */
58
    public function setPrefix($prefix) {
59
        $this->prefix = $prefix;
60
    }
61
}
62