BookmarksCommand::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 string getRev()
23
 * @method void setRev(string $revision)
24
 * @method boolean getDelete()
25
 * @method void setDelete(boolean $flag)
26
 * @method string getRename()
27
 * @method void setRename(string $name)
28
 * @method boolean getInactive()
29
 * @method void setInactive(boolean $flag)
30
 */
31
class BookmarksCommand extends AbstractCommand
32
{
33
    /**
34
     * Available arguments for this command.
35
     *
36
     * @var array $arguments
37
     */
38
    protected $arguments = [
39
        'name'        => []
40
    ];
41
42
    /**
43
     * {@inheritdoc}
44
     *
45
     * @var mixed $options
46
     */
47
    protected $options = [
48
        '--force'    => false,
49
        '--rev'      => '',
50
        '--delete'   => false,
51
        '--rename'   => '',
52
        '--inactive' => false
53
    ];
54
55
    /**
56
     * @return array
57
     */
58 1
    public function getName()
59
    {
60 1
        return $this->arguments['name'];
61
    }
62
63
    /**
64
     * @param string $name
65
     *
66
     * @return void
67
     */
68 1
    public function addName($name)
69
    {
70 1
        $this->arguments['name'][] = escapeshellarg($name);
71 1
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 1
    public function __toString()
77
    {
78 1
        return sprintf(
79 1
            "%s%s %s",
80 1
            $this->name,
81 1
            $this->assembleOptionString(),
82 1
            implode(' ', $this->arguments['name'])
83
        );
84
    }
85
}
86