LogCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFile() 0 4 1
A setFile() 0 6 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 getFollow()
21
 * @method LogCommand setFollow(boolean $flag)
22
 * @method string getDate()
23
 * @method LogCommand setDate(string $date)
24
 * @method boolean getCopies()
25
 * @method LogCommand setCopies(boolean $flag)
26
 * @method array getKeyword()
27
 * @method LogCommand addKeyword(string $text)
28
 * @method array getRev()
29
 * @method LogCommand setRev(string $revision)
30
 * @method boolean getRemoved()
31
 * @method LogCommand setRemoved(boolean $flag)
32
 * @method array getUser()
33
 * @method LogCommand addUser(string $user)
34
 * @method array getBranch()
35
 * @method LogCommand addBranch(string $branch)
36
 * @method array getPrune()
37
 * @method LogCommand addPrune(string $revision)
38
 * @method boolean getPatch()
39
 * @method LogCommand setPatch(boolean $flag)
40
 * @method boolean getGit()
41
 * @method LogCommand setGit(boolean $flag)
42
 * @method array getLimit()
43
 * @method LogCommand setLimit(string $number)
44
 * @method boolean getNoMerges()
45
 * @method LogCommand setNoMerges(boolean $flag)
46
 * @method boolean getStat()
47
 * @method LogCommand setStat(boolean $flag)
48
 * @method boolean getGraph()
49
 * @method LogCommand setGraph(boolean $flag)
50
 * @method array getTemplate()
51
 * @method LogCommand setTemplate(string $template)
52
 * @method array getInclude()
53
 * @method LogCommand addInclude(string $pattern)
54
 * @method array getExclude()
55
 * @method LogCommand addExclude(string $pattern)
56
 */
57
class LogCommand extends AbstractCommand
58
{
59
    /**
60
     * Available arguments for this command.
61
     *
62
     * @var array $arguments
63
     */
64
    protected $arguments = [
65
        'file' => ''
66
    ];
67
68
    /**
69
     * {@inheritdoc}
70
     *
71
     * @var mixed $options
72
     */
73
    protected $options = [
74
        '--follow' => false,
75
        '--date'      => '',
76
        '--copies'    => false,
77
        '--keyword'   => [],
78
        '--rev'       => [],
79
        '--removed'   => false,
80
        '--user'      => [],
81
        '--branch'    => [],
82
        '--prune'     => [],
83
        '--patch'     => false,
84
        '--git'       => false,
85
        '--limit'     => '',
86
        '--no-merges' => false,
87
        '--stat'      => false,
88
        '--graph'     => false,
89
        '--template'  => '',
90
        '--include'   => [],
91
        '--exclude'   => [],
92
    ];
93
94
    /**
95
     * Get the file argument.
96
     *
97
     * @return string
98
     */
99 1
    public function getFile()
100
    {
101 1
        return $this->arguments['file'];
102
    }
103
104
    /**
105
     * Set the file argument.
106
     *
107
     * @param string $file
108
     *
109
     * @return LogCommand
110
     */
111 1
    public function setFile($file)
112
    {
113 1
        $this->arguments['file'] = escapeshellarg($file);
114
115 1
        return $this;
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121 1
    public function __toString()
122
    {
123 1
        return sprintf(
124 1
            "%s%s %s",
125 1
            $this->name,
126 1
            $this->assembleOptionString(),
127 1
            $this->arguments['file']
128
        );
129
    }
130
}
131