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

Application   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 72.21%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 7
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 65
ccs 13
cts 18
cp 0.7221
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getStringVersion() 0 9 2
A getCVVersion() 0 6 2
A getConfiguration() 0 4 1
A getIssuesCollector() 0 4 1
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