TagCommand::addName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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 getForce()
21
 * @method void setForce(boolean $flag)
22
 * @method boolean getLocal()
23
 * @method void setLocal(boolean $flag)
24
 * @method string getRev()
25
 * @method void setRev(string $revision)
26
 * @method boolean getRemove()
27
 * @method void setRemove(boolean $flag)
28
 * @method boolean getEdit()
29
 * @method void setEdit(boolean $flag)
30
 * @method string getMessage()
31
 * @method void setMessage(string $text)
32
 * @method string getDate()
33
 * @method void setDate(string $date)
34
 * @method string getUser()
35
 * @method void setUser(string $user)
36
 */
37
class TagCommand extends AbstractCommand
38
{
39
    /**
40
     * Available arguments for this command.
41
     *
42
     * @var array $arguments
43
     */
44
    protected $arguments = [
45
        'name' => []
46
    ];
47
48
    /**
49
     * {@inheritdoc}
50
     *
51
     * @var mixed $options
52
     */
53
    protected $options = [
54
        '--force'   => false,
55
        '--local'   => false,
56
        '--rev'     => '',
57
        '--remove'  => false,
58
        '--edit'    => false,
59
        '--message' => '',
60
        '--date'    => '',
61
        '--user'    => ''
62
    ];
63
64
    /**
65
     * @return array
66
     */
67 1
    public function getName()
68
    {
69 1
        return $this->arguments['name'];
70
    }
71
72
    /**
73
     * @param string $name
74
     *
75
     * @return void
76
     */
77 1
    public function addName($name)
78
    {
79 1
        $this->arguments['name'][] = $name;
80 1
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85 1
    public function __toString()
86
    {
87 1
        return sprintf(
88 1
            "%s%s %s",
89 1
            $this->name,
90 1
            $this->assembleOptionString(),
91 1
            implode(' ', $this->arguments['name'])
92
        );
93
    }
94
}
95