PushCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 62
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDestination() 0 4 1
A setDestination() 0 4 1
A __toString() 0 9 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 getForce()
21
 * @method void setForce(boolean $flag)
22
 * @method string getNewBranch()
23
 * @method void setNewBranch(boolean $flag)
24
 * @method string getSsh()
25
 * @method void setSsh(string $command)
26
 * @method string getRemotecmd()
27
 * @method void setRemotecmd(string $command)
28
 * @method boolean getInsecure()
29
 * @method void setInsecure(boolean $flag)
30
 * @method array getRev()
31
 * @method void addRev(string $revision)
32
 * @method array getBookmark()
33
 * @method void addBookmark(string $bookmark)
34
 * @method array getBranch()
35
 * @method void addBranch(string $branch)
36
 */
37
class PushCommand extends AbstractCommand
38
{
39
    /**
40
     * Available arguments for this command.
41
     *
42
     * @var array $arguments
43
     */
44
    protected $arguments = [
45
        'destination' => ''
46
    ];
47
48
    /**
49
     * {@inheritdoc}
50
     *
51
     * @var mixed $options
52
     */
53
    protected $options = [
54
        '--force'      => false,
55
        '--rev'        => [],
56
        '--bookmark'   => [],
57
        '--branch'     => [],
58
        '--new-branch' => false,
59
        '--ssh'        => '',
60
        '--remotecmd'  => '',
61
        '--insecure'   => false
62
    ];
63
64
    /**
65
     * Get the destination.
66
     *
67
     * @return string
68
     */
69 1
    public function getDestination()
70
    {
71 1
        return $this->arguments['destination'];
72
    }
73
74
    /**
75
     * Set the destination.
76
     *
77
     * @param string $destination
78
     *
79
     * @return void
80
     */
81 1
    public function setDestination($destination)
82
    {
83 1
        $this->arguments['destination'] = escapeshellarg($destination);
84 1
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89 1
    public function __toString()
90
    {
91 1
        return sprintf(
92 1
            "%s%s %s",
93 1
            $this->name,
94 1
            $this->assembleOptionString(),
95 1
            $this->arguments['destination']
96
        );
97
    }
98
}
99