ConfigCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 60
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A addName() 0 6 1
A __toString() 0 9 1
1
<?php
2
/**
3
 * VersionControl_HG
4
 * Simple OO implementation for Mercurial.
5
 *
6
 * PHP Version 5.4
7
 *
8
 * @copyright 2014 Siad Ardroumli
9
 * @license http://www.opensource.org/licenses/mit-license.php MIT
10
 * @link http://siad007.github.io/versioncontrol_hg
11
 */
12
13
namespace Siad007\VersionControl\HG\Command;
14
15
/**
16
 * Simple OO implementation for Mercurial.
17
 *
18
 * @author Siad Ardroumli <[email protected]>
19
 *
20
 * @method boolean getUntrusted()
21
 * @method ConfigCommand setUntrusted(boolean $flag)
22
 * @method boolean getEdit()
23
 * @method ConfigCommand setEdit(boolean $flag)
24
 * @method boolean getLocal()
25
 * @method ConfigCommand setLocal(boolean $flag)
26
 * @method boolean getGlobal()
27
 * @method ConfigCommand setGlobal(boolean $flag)
28
 */
29
class ConfigCommand extends AbstractCommand
30
{
31
    /**
32
     * Available arguments for this command.
33
     *
34
     * @var array $arguments
35
     */
36
    protected $arguments = [
37
        'name' => []
38
    ];
39
40
    /**
41
     * Get the name argument.
42
     *
43
     * @return array
44
     */
45 1
    public function getName()
46
    {
47 1
        return $this->arguments['name'];
48
    }
49
50
    /**
51
     * Add a name to the argument.
52
     *
53
     * @param string $name
54
     *
55
     * @return ConfigCommand
56
     */
57 1
    public function addName($name)
58
    {
59 1
        $this->arguments['name'][] = escapeshellarg($name);
60
61 1
        return $this;
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     *
67
     * @var mixed $options
68
     */
69
    protected $options = [
70
        '--untrusted' => false,
71
        '--edit'      => false,
72
        '--local'     => false,
73
        '--global'    => false
74
    ];
75
76
    /**
77
     * {@inheritdoc}
78
     */
79 1
    public function __toString()
80
    {
81 1
        return sprintf(
82 1
            "%s%s %s",
83 1
            $this->name,
84 1
            $this->assembleOptionString(),
85 1
            implode(' ', $this->arguments['name'])
86
        );
87
    }
88
}
89