RemoteAddCommand::getCommandLine()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
crap 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
use ComponentManager\VersionControl\Git\GitRemote;
14
15
/**
16
 * Initialise a new repository.
17
 */
18
class RemoteAddCommand implements Command {
19
    /**
20
     * Remote.
21
     *
22
     * @var GitRemote
23
     */
24
    protected $remote;
25
26
    /**
27
     * Initialiser.
28
     *
29
     * @param GitRemote $remote
30
     */
31 1
    public function __construct(GitRemote $remote) {
32 1
        $this->remote = $remote;
33 1
    }
34
35
    /**
36
     * @inheritdoc Command
37
     */
38 1
    public function getCommandLine() {
39
        return [
40 1
            'remote',
41 1
            'add',
42 1
            $this->remote->getName(),
43 1
            $this->remote->getUri(),
44
        ];
45
    }
46
47
    /**
48
     * Get the remote.
49
     *
50
     * @return GitRemote
51
     *
52
     * @codeCoverageIgnore
53
     */
54
    public function getRemote() {
55
        return $this->remote;
56
    }
57
58
    /**
59
     * Set the remote.
60
     *
61
     * @param GitRemote $remote
62
     *
63
     * @codeCoverageIgnore
64
     */
65
    public function setRemote($remote) {
66
        $this->remote = $remote;
67
    }
68
}
69