GitController::getComponent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\console;
12
13
/**
14
 * Git.
15
 */
16
class GitController extends \hidev\base\Controller
17
{
18
    protected $_before = ['.gitignore'];
19
20
    /**
21
     * @var string current tag
22
     */
23
    protected $tag;
24
25
    public function actionRelease($release = null)
26
    {
27
        $release = $this->take('version')->getRelease($release);
28
        $message = "version bump to $release";
29
        $this->getComponent()->commit($message);
30
        $this->getComponent()->tag($release);
31
32
        return $this->getComponent()->push();
33
    }
34
35
    public function actionCommit($message)
36
    {
37
        return $this->getComponent()->commit($message);
38
    }
39
40
    public function actionTag($tag)
41
    {
42
        return $this->getComponent()->tag($tag);
43
    }
44
45
    public function actionPush()
46
    {
47
        return $this->getComponent()->push();
48
    }
49
50
    public function getComponent()
51
    {
52
        return $this->take('git');
53
    }
54
}
55