ArchiveCommand::setDestination()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
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 getNoDecode()
21
 * @method void setNoDecode(boolean $flag)
22
 * @method string getPrefix()
23
 * @method void setPrefix(string $prefix)
24
 * @method string getRev()
25
 * @method void setRev(string $revision)
26
 * @method string getType()
27
 * @method void setType(string $type)
28
 * @method boolean getSubrepos()
29
 * @method void setSubrepos(boolean $flag)
30
 * @method array getInclude()
31
 * @method void addInclude(string $pattern)
32
 * @method array getExclude()
33
 * @method void addExclude(string $pattern)
34
 */
35
class ArchiveCommand extends AbstractCommand
36
{
37
    /**
38
     * Available arguments for this command.
39
     *
40
     * @var array $arguments
41
     */
42
    protected $arguments = [
43
        'dest' => ''
44
    ];
45
46
    /**
47
     * {@inheritdoc}
48
     *
49
     * @var mixed $options
50
     */
51
    protected $options = [
52
        '--no-decode' => false,
53
        '--prefix'    => '',
54
        '--rev'       => '',
55
        '--type'      => '',
56
        '--subrepos'  => false,
57
        '--include'   => [],
58
        '--exclude'   => [],
59
    ];
60
61
    /**
62
     * Get the destination argument.
63
     *
64
     * @return string
65
     */
66 1
    public function getDestination()
67
    {
68 1
        return $this->arguments['dest'];
69
    }
70
71
    /**
72
     * Set the destination argument.
73
     *
74
     * @param string $dest
75
     *
76
     * @return ArchiveCommand
77
     */
78 1
    public function setDestination($dest)
79
    {
80 1
        $this->arguments['dest'] = escapeshellarg($dest);
81
82 1
        return $this;
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88 1
    public function __toString()
89
    {
90 1
        return sprintf(
91 1
            "%s%s %s",
92 1
            $this->name,
93 1
            $this->assembleOptionString(),
94 1
            $this->arguments['dest']
95
        );
96
    }
97
}
98