CatCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
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 55
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 addFile() 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 getOutput()
21
 * @method void setOutput(string $output)
22
 * @method string getRev()
23
 * @method void setRev(string $output)
24
 * @method boolean getDecode()
25
 * @method void setDecode(boolean $flag)
26
 * @method array getInclude()
27
 * @method void addInclude(string $pattern)
28
 * @method array getExclude()
29
 * @method void addExclude(string $pattern)
30
 */
31
class CatCommand extends AbstractCommand
32
{
33
    /**
34
     * Available arguments for this command.
35
     *
36
     * @var array $arguments
37
     */
38
    protected $arguments = [
39
        'file' => []
40
    ];
41
42
    /**
43
     * {@inheritdoc}
44
     *
45
     * @var mixed $options
46
     */
47
    protected $options = [
48
        '--output'  => '',
49
        '--rev'     => '',
50
        '--decode'  => false,
51
        '--include' => [],
52
        '--exclude' => [],
53
    ];
54
55
    /**
56
     * @return array
57
     */
58 1
    public function getFile()
59
    {
60 1
        return $this->arguments['file'];
61
    }
62
63
    /**
64
     * @param string $file
65
     *
66
     * @return void
67
     */
68 1
    public function addFile($file)
69
    {
70 1
        $this->arguments['file'][] = escapeshellarg($file);
71 1
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 1
    public function __toString()
77
    {
78 1
        return sprintf(
79 1
            "%s%s %s",
80 1
            $this->name,
81 1
            $this->assembleOptionString(),
82 1
            implode(' ', $this->arguments['file'])
83
        );
84
    }
85
}
86