Completed
Push — master ( d7794a...32d811 )
by Andrii
15:02
created

BoxController::actionBuild()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * Box plugin for HiDev
5
 *
6
 * @link      https://github.com/hiqdev/hidev-box
7
 * @package   hidev-box
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\box\console;
13
14
/**
15
 * Goal for Box.
16
 */
17
class BoxController extends \hidev\controllers\CommonController
18
{
19
    protected $_before = ['install', 'box.json'];
20
21
    public $verbose;
22
23
    public function getConfiguration()
24
    {
25
        return $this->take('box.json');
26
    }
27
28
    public function actionIndex()
29
    {
30
        $this->take('vcs')->setIgnore([
31
            $this->getConfiguration()->get('output') => 'Binaries',
32
        ]);
33
        /// TODO fix to use general vcsignore
34
        $this->runRequest('.gitignore');
0 ignored issues
show
Documentation Bug introduced by
The method runRequest does not exist on object<hidev\box\console\BoxController>? 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...
35
36
        return $this->runBuild();
37
    }
38
39
    public function actionBuild()
40
    {
41
        $this->runBuild();
42
    }
43
44
    public function runBuild()
45
    {
46
        $args = ['build'];
47
        if ($this->verbose) {
48
            $args[] = '--verbose';
49
        }
50
51
        return $this->passthru('box', $args);
52
    }
53
}
54