Completed
Push — master ( 90ed95...4bbc63 )
by Дмитрий
06:02
created

Application::getIssuesCollector()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA;
7
8
use PHPSA\Command\CheckCommand;
9
10
class Application extends \Symfony\Component\Console\Application
11
{
12
    /**
13
     * @var Configuration
14
     */
15
    protected $configuration;
16
17
    /**
18
     * @var IssuesCollector
19
     */
20
    protected $issuesCollector;
21
22
    /**
23
     * @var Compiler
24
     */
25
    public $compiler;
26
27
    const VERSION = '0.4-dev';
28
29 366
    public function __construct()
30
    {
31 366
        parent::__construct('PHP Static Analyzer', $this->getStringVersion());
32
33 366
        $this->add(new CheckCommand());
34
35 366
        $this->issuesCollector = new IssuesCollector();
36 366
        $this->configuration = new Configuration();
37 366
    }
38
39
    /**
40
     * @return string
41
     */
42 366
    protected function getStringVersion()
43
    {
44 366
        $hash = $this->getCVVersion();
45 366
        if (!empty($hash)) {
46 366
            return self::VERSION . ' #' . $hash;
47
        }
48
49
        return self::VERSION;
50
    }
51
52 366
    protected function getCVVersion()
53
    {
54 366
        exec('git describe --always', $version_mini_hash);
55
56 366
        return $version_mini_hash ? $version_mini_hash[0] : '';
57
    }
58
59
    /**
60
     * @return Configuration
61
     */
62
    public function getConfiguration()
63
    {
64
        return $this->configuration;
65
    }
66
67
    /**
68
     * @return IssuesCollector
69
     */
70
    public function getIssuesCollector()
71
    {
72
        return $this->issuesCollector;
73
    }
74
}
75