Completed
Push — develop ( c2a9e5...4f0107 )
by Siad
7s
created

UpdateCommand::getBranch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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 getClean()
21
 * @method void setClean(boolean $flag)
22
 * @method boolean getCheck()
23
 * @method void setCheck(boolean $flag)
24
 * @method string getDate()
25
 * @method void setDate(string $date)
26
 * @method string getRev()
27
 * @method void setRev(string $rev)
28
 */
29
class UpdateCommand extends AbstractCommand
30
{
31
    /**
32
     * Available arguments for this command.
33
     *
34
     * @var array $arguments
35
     */
36
    protected $arguments = [
37
        'branch' => ''
38
    ];
39
40
    /**
41
     * {@inheritdoc}
42
     *
43
     * @var mixed $options
44
     */
45
    protected $options = [
46
        '--clean' => false,
47
        '--check' => false,
48
        '--date'  => '',
49
        '--rev'   => ''
50
    ];
51
52
    public function getBranch()
53
    {
54
        return $this->arguments['branch'];
55
    }
56
57
    /**
58
     * @param string $branch
59
     *
60
     * @return void
61
     */
62
    public function setBranch($branch)
63
    {
64
        $this->arguments['branch'] = escapeshellarg($branch);
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function __toString()
71
    {
72
        return sprintf(
73
            "%s%s %s",
74
            $this->name,
75
            $this->assembleOptionString(),
76
            $this->arguments['branch']
77
        );
78
    }
79
}
80