RevertCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 57
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 57
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A addName() 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 boolean getAll()
21
 * @method void setAll(boolean $flag)
22
 * @method string getDate()
23
 * @method void setDate(string $date)
24
 * @method string getRev()
25
 * @method void setRev(string $revision)
26
 * @method boolean getNoBackup()
27
 * @method void setNoBackup(boolean $flag)
28
 * @method array getInclude()
29
 * @method void addInclude(string $pattern)
30
 * @method array getExclude()
31
 * @method void addExclude(string $pattern)
32
 * @method boolean getDryRun()
33
 * @method void setDryRun(boolean $flag)
34
 */
35
class RevertCommand extends AbstractCommand
36
{
37
    /**
38
     * Available arguments for this command.
39
     *
40
     * @var array $arguments
41
     */
42
    protected $arguments = [
43
        'name' => []
44
    ];
45
46
    /**
47
     * {@inheritdoc}
48
     *
49
     * @var mixed $options
50
     */
51
    protected $options = [
52
        '--all'       => false,
53
        '--date'      => '',
54
        '--rev'       => '',
55
        '--no-backup' => false,
56
        '--include'   => [],
57
        '--exclude'   => [],
58
        '--dry-run'   => false
59
    ];
60
61
    /**
62
     * @return array
63
     */
64 1
    public function getName()
65
    {
66 1
        return $this->arguments['name'];
67
    }
68
69
    /**
70
     * @param string $name
71
     *
72
     * @return void
73
     */
74 1
    public function addName($name)
75
    {
76 1
        $this->arguments['name'][] = escapeshellarg($name);
77 1
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82 1
    public function __toString()
83
    {
84 1
        return sprintf(
85 1
            "%s%s %s",
86 1
            $this->name,
87 1
            $this->assembleOptionString(),
88 1
            implode(' ', $this->arguments['name'])
89
        );
90
    }
91
}
92