ResolveCommand::addFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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 boolean getAll()
21
 * @method void setAll(boolean $flag)
22
 * @method boolean getList()
23
 * @method void setList(boolean $flag)
24
 * @method boolean getMark()
25
 * @method void setMark(boolean $flag)
26
 * @method boolean getUnmark()
27
 * @method void setUnmark(boolean $flag)
28
 * @method boolean getNoStatus()
29
 * @method void setNoStatus(boolean $flag)
30
 * @method string getTool()
31
 * @method void setTool(string $tool)
32
 * @method array getInclude()
33
 * @method void addInclude(string $pattern)
34
 * @method array getExclude()
35
 * @method void addExclude(string $pattern)
36
 */
37
class ResolveCommand extends AbstractCommand
38
{
39
    /**
40
     * Available arguments for this command.
41
     *
42
     * @var array $arguments
43
     */
44
    protected $arguments = [
45
        'file' => []
46
    ];
47
48
    /**
49
     * {@inheritdoc}
50
     *
51
     * @var mixed $options
52
     */
53
    protected $options = [
54
        '--all'       => false,
55
        '--list'      => false,
56
        '--mark'      => false,
57
        '--unmark'    => false,
58
        '--no-status' => false,
59
        '--tool'      => '',
60
        '--include'   => [],
61
        '--exclude'   => []
62
    ];
63
64
    /**
65
     * @return array
66
     */
67 1
    public function getFile()
68
    {
69 1
        return $this->arguments['file'];
70
    }
71
72
    /**
73
     * @param string $file
74
     *
75
     * @return void
76
     */
77 1
    public function addFile($file)
78
    {
79 1
        $this->arguments['file'][] = escapeshellarg($file);
80 1
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85 1
    public function __toString()
86
    {
87 1
        return sprintf(
88 1
            "%s%s %s",
89 1
            $this->name,
90 1
            $this->assembleOptionString(),
91 1
            implode(' ', $this->arguments['file'])
92
        );
93
    }
94
}
95