TravisController   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 2
dl 0
loc 54
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A actionRun() 0 9 2
A actionBeforeInstall() 0 4 1
A actionInstall() 0 4 1
A actionBeforeScript() 0 4 1
A actionScript() 0 4 1
A actionAfterSuccess() 0 4 1
A actionAfterFailure() 0 4 1
A actionAfterScript() 0 4 1
A getComponent() 0 4 1
1
<?php
2
/**
3
 * Travis CI plugin for HiDev.
4
 *
5
 * @link      https://github.com/hiqdev/hidev-travis
6
 * @package   hidev-travis
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\travis\console;
12
13
use hidev\helpers\Helper;
14
15
/**
16
 * Travis CI.
17
 */
18
class TravisController extends \hidev\base\Controller
19
{
20
    public $defaultAction = 'run';
21
22
    public function actionRun()
23
    {
24
        $this->runActions(['before-install', 'install']);
25
        $res = $this->runActions(['before-script', 'script']);
26
        $this->runAction(!Helper::isResponseOk($res) ? 'after-failure' : 'after-success');
27
        $this->runAction('after-script');
28
29
        return $res;
30
    }
31
32
    public function actionBeforeInstall()
33
    {
34
        return $this->runRequests($this->getComponent()->before_install);
0 ignored issues
show
Documentation Bug introduced by
The method runRequests does not exist on object<hidev\travis\console\TravisController>? 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
37
    public function actionInstall()
38
    {
39
        return $this->runRequests($this->getComponent()->install);
0 ignored issues
show
Documentation Bug introduced by
The method runRequests does not exist on object<hidev\travis\console\TravisController>? 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...
40
    }
41
42
    public function actionBeforeScript()
43
    {
44
        return $this->runRequests($this->getComponent()->before_script);
0 ignored issues
show
Documentation Bug introduced by
The method runRequests does not exist on object<hidev\travis\console\TravisController>? 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...
45
    }
46
47
    public function actionScript()
48
    {
49
        return $this->runRequests($this->getComponent()->script);
0 ignored issues
show
Documentation Bug introduced by
The method runRequests does not exist on object<hidev\travis\console\TravisController>? 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...
50
    }
51
52
    public function actionAfterSuccess()
53
    {
54
        return $this->runRequests($this->getComponent()->after_success);
0 ignored issues
show
Documentation Bug introduced by
The method runRequests does not exist on object<hidev\travis\console\TravisController>? 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...
55
    }
56
57
    public function actionAfterFailure()
58
    {
59
        return $this->runRequests($this->getComponent()->after_failure);
0 ignored issues
show
Documentation Bug introduced by
The method runRequests does not exist on object<hidev\travis\console\TravisController>? 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...
60
    }
61
62
    public function actionAfterScript()
63
    {
64
        return $this->runRequests($this->getComponent()->after_script);
0 ignored issues
show
Documentation Bug introduced by
The method runRequests does not exist on object<hidev\travis\console\TravisController>? 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...
65
    }
66
67
    public function getComponent()
68
    {
69
        return $this->take('travis');
70
    }
71
}
72