ChkipperController::actionBump()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 1
dl 0
loc 11
ccs 0
cts 7
cp 0
crap 12
rs 9.9
c 0
b 0
f 0
1
<?php
2
/**
3
 * HiDev plugin for Chkipper
4
 *
5
 * @link      https://github.com/hiqdev/hidev-chkipper
6
 * @package   hidev-chkipper
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2020, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\chkipper\console;
12
13
/**
14
 * chkipper.
15
 */
16
class ChkipperController extends \hidev\base\Controller
17
{
18
    protected $_before = ['chkipper.json'];
19
20
    public $defaultAction = 'bump';
21
22
    public function getConfiguration()
23
    {
24
        return $this->take('chkipper.json');
25
    }
26
27
    public function actionBump($version = null)
28
    {
29
        $version = $version ?: $this->module->request->getParams()[1];
30
        $args = ['bump'];
31
        $this->take('version')->update($version);
32
        if ($version) {
33
            $args[] = $version;
34
        }
35
36
        return $this->passthru('chkipper', $args);
37
    }
38
39
    public function actionReleaseNotes()
40
    {
41
        echo $this->take('chkipper')->getReleaseNotes() . PHP_EOL;
42
    }
43
44
    public function actionCommit($message = 'bump')
45
    {
46
        $this->take('vcs')->commit($message);
47
    }
48
}
49