InitCommand::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
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 string getSsh()
21
 * @method void setSsh(string $command)
22
 * @method string getRemotecmd()
23
 * @method void setRemotecmd(string $command)
24
 * @method boolean getInsecure()
25
 * @method void setInsecure(boolean $flag)
26
 */
27
class InitCommand extends AbstractCommand
28
{
29
    /**
30
     * Available arguments for this command.
31
     *
32
     * @var array $arguments
33
     */
34
    protected $arguments = [
35
        'destination' => '.'
36
    ];
37
38
    /**
39
     * {@inheritdoc}
40
     *
41
     * @var mixed $options
42
     */
43
    protected $options = [
44
        '--ssh'       => '',
45
        '--remotecmd' => '',
46
        '--insecure'  => false
47
    ];
48
49
    /**
50
     * @return string
51
     */
52 1
    public function getDestination()
53
    {
54 1
        return $this->arguments['destination'];
55
    }
56
57
    /**
58
     * @param string $destination
59
     *
60
     * @return void
61
     */
62 1
    public function setDestination($destination)
63
    {
64 1
        $this->arguments['destination'] = escapeshellarg($destination);
65 1
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70 1
    public function __toString()
71
    {
72 1
        return sprintf(
73 1
            "%s%s %s",
74 1
            $this->name,
75 1
            $this->assembleOptionString(),
76 1
            $this->arguments['destination']
77
        );
78
    }
79
}
80