Passed
Push — master ( fc9abb...9945a9 )
by Luke
02:47
created

CheckoutCommand   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 getRef() 0 3 1
A setRef() 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
 * Checkout a reference or file.
15
 */
16
class CheckoutCommand implements Command {
17
    /**
18
     * Reference.
19
     *
20
     * @var string
21
     */
22
    protected $ref;
23
24
    /**
25
     * Initialiser.
26
     *
27
     * @param string $ref
28
     */
29 1
    public function __construct($ref) {
30 1
        $this->ref = $ref;
31 1
    }
32
33
    /**
34
     * @override Command
35
     */
36 1
    public function getCommandLine() {
37 1
        return ['checkout', $this->ref];
38
    }
39
40
    /**
41
     * Get the reference.
42
     *
43
     * @return string
44
     *
45
     * @codeCoverageIgnore
46
     */
47
    public function getRef() {
48
        return $this->ref;
49
    }
50
51
    /**
52
     * Set the reference.
53
     *
54
     * @param string $ref
55
     *
56
     * @codeCoverageIgnore
57
     */
58
    public function setRef($ref) {
59
        $this->ref = $ref;
60
    }
61
}
62