Completed
Push — master ( 375de1...c13e1e )
by Andrii
13:21
created

GettersTrait::getView()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 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-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\base;
12
13
use Yii;
14
15
/**
16
 * Getters trait.
17
 */
18
trait GettersTrait
19
{
20
    protected $_view;
21
22
    public function getView()
23
    {
24
        if ($this->_view === null) {
25
            $this->_view = $this->getApp()->getView();
26
        }
27
28
        return $this->_view;
29
    }
30
31
    public function take($id)
32
    {
33
        return $this->getApp()->get($id);
34
    }
35
36
    public function getApp()
37
    {
38
        return Yii::$app;
39
    }
40
41
    /**
42
     * Runs given binary with given arguments.
43
     * Command output passes unchanged to console.
44
     * Returns exit code.
45
     * @param string $name
46
     * @param array|string $args
47
     * @return int exit code
48
     */
49
    public function passthru($name, $args = [])
50
    {
51
        return $this->take('binaries')->passthruBinary($name, $args);
52
    }
53
54
    /**
55
     * Runs given binary with given arguments. Returns stdout array.
56
     * @param string $name
57
     * @param string $args
58
     * @param bool $returnExitCode, default false
0 ignored issues
show
Documentation introduced by
There is no parameter named $returnExitCode,. Did you maybe mean $returnExitCode?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
59
     * @return array|int stdout or exitcode
60
     */
61
    public function exec($name, $args = '', $returnExitCode = false)
62
    {
63
        return $this->take('binaries')->execBinary($name, $args, $returnExitCode);
64
    }
65
66
    public function execCode($name, $args = '')
67
    {
68
        return $this->take('binaries')->execBinary($name, $args, true);
69
    }
70
}
71