BundleCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 83
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getFile() 0 4 1
A setFile() 0 4 1
A getDestination() 0 4 1
A setDestination() 0 4 1
A __toString() 0 10 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 boolean getAll()
23
 * @method void setAll(boolean $flag)
24
 * @method string getType()
25
 * @method void setType(string $command)
26
 * @method string getSsh()
27
 * @method void setSsh(string $command)
28
 * @method string getRemotecmd()
29
 * @method void setRemotecmd(string $command)
30
 * @method boolean getInsecure()
31
 * @method void setInsecure(boolean $flag)
32
 * @method array getRev()
33
 * @method void addRev(string $revision)
34
 * @method array getBase()
35
 * @method void addBase(string $base)
36
 * @method array getBranch()
37
 * @method void addBranch(string $branch)
38
 */
39
class BundleCommand extends AbstractCommand
40
{
41
    /**
42
     * Available arguments for this command.
43
     *
44
     * @var array $arguments
45
     */
46
    protected $arguments = [
47
        'file'        => '',
48
        'destination' => '',
49
    ];
50
51
    /**
52
     * {@inheritdoc}
53
     *
54
     * @var mixed $options
55
     */
56
    protected $options = [
57
        '--force'      => false,
58
        '--rev'        => [],
59
        '--branch'     => [],
60
        '--base'       => [],
61
        '--all'        => false,
62
        '--type'       => '',
63
        '--ssh'        => '',
64
        '--remotecmd'  => '',
65
        '--insecure'   => false
66
    ];
67
68
    /**
69
     * @return string
70
     */
71 1
    public function getFile()
72
    {
73 1
        return $this->arguments['file'];
74
    }
75
76
    /**
77
     * @param string $file
78
     *
79
     * @return void
80
     */
81 1
    public function setFile($file)
82
    {
83 1
        $this->arguments['file'] = escapeshellarg($file);
84 1
    }
85
86
    /**
87
     * Get the destination.
88
     *
89
     * @return string
90
     */
91 1
    public function getDestination()
92
    {
93 1
        return $this->arguments['destination'];
94
    }
95
96
    /**
97
     * Set the destination.
98
     *
99
     * @param string $destination
100
     *
101
     * @return void
102
     */
103 1
    public function setDestination($destination)
104
    {
105 1
        $this->arguments['destination'] = escapeshellarg($destination);
106 1
    }
107
108
    /**
109
     * {@inheritdoc}
110
     */
111 1
    public function __toString()
112
    {
113 1
        return sprintf(
114 1
            "%s%s %s%s",
115 1
            $this->name,
116 1
            $this->assembleOptionString(),
117 1
            $this->arguments['file'],
118 1
            ' ' . $this->arguments['destination']
119
        );
120
    }
121
}
122