Completed
Push — master ( 8102ce...e70eb4 )
by Andrii
09:59
created

ChkipperController::actionReleaseNotes()   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 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * Chkipper plugin for HiDev
5
 *
6
 * @link      https://github.com/hiqdev/hidev-chkipper
7
 * @package   hidev-chkipper
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\chkipper\controllers;
13
14
/**
15
 * Goal for Chkipper.
16
 */
17
class ChkipperController extends \hidev\controllers\CommonController
18
{
19
    protected $_before = ['chkipper.json'];
20
21
    public function getConfiguration()
22
    {
23
        return $this->getGoal('chkipper.json');
0 ignored issues
show
Documentation Bug introduced by
The method getGoal does not exist on object<hidev\chkipper\co...ers\ChkipperController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
24
    }
25
26
    public function actionMake()
27
    {
28
        return $this->actionBump();
29
    }
30
31
    public function actionBump($version = null)
32
    {
33
        $version = $version ?: $this->module->request->getParams()[1];
34
        $args = ['bump'];
35
        if ($version) {
36
            $this->takeGoal('version')->actionMake($version);
37
            $args[] = $version;
38
        }
39
40
        return $this->passthru('chkipper', $args);
41
    }
42
43
    public function actionReleaseNotes()
44
    {
45
        echo $this->getReleaseNotes() . PHP_EOL;
46
    }
47
48
    public function getReleaseNotes()
49
    {
50
        return implode(PHP_EOL, $this->exec('chkipper', 'release-notes'));
51
    }
52
}
53