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

CheckoutIndexCommand::setPrefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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