Completed
Push — master ( 106423...225215 )
by Andrii
13:51
created

TravisController   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

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
/*
4
 * Travis CI plugin for HiDev
5
 *
6
 * @link      https://github.com/hiqdev/hidev-travis
7
 * @package   hidev-travis
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\travis\console;
13
14
/**
15
 * Travis CI.
16
 */
17
class TravisController extends \hidev\base\Controller
18
{
19
    public $defaultAction = 'run';
20
21
    public function actionRun()
22
    {
23
        $this->runActions(['before-install', 'install']);
0 ignored issues
show
Bug introduced by
The method runActions() does not exist on hidev\travis\console\TravisController. Did you maybe mean actions()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
24
        $res = $this->runActions(['before-script', 'script']);
0 ignored issues
show
Bug introduced by
The method runActions() does not exist on hidev\travis\console\TravisController. Did you maybe mean actions()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
25
        $this->runAction(static::isNotOk($res) ? 'after-failure' : 'after-success');
0 ignored issues
show
Bug introduced by
The method isNotOk() does not seem to exist on object<hidev\travis\console\TravisController>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
        $this->runAction('after-script');
27
28
        return $res;
29
    }
30
31
    public function actionBeforeInstall()
32
    {
33
        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...
34
    }
35
36
    public function actionInstall()
37
    {
38
        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...
39
    }
40
41
    public function actionBeforeScript()
42
    {
43
        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...
44
    }
45
46
    public function actionScript()
47
    {
48
        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...
49
    }
50
51
    public function actionAfterSuccess()
52
    {
53
        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...
54
    }
55
56
    public function actionAfterFailure()
57
    {
58
        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...
59
    }
60
61
    public function actionAfterScript()
62
    {
63
        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...
64
    }
65
66
    public function getComponent()
67
    {
68
        return $this->take('travis');
69
    }
70
}
71