Completed
Push — master ( a5ecda...2f43c7 )
by Andrii
98:59 queued 41:11
created

TravisController::actionMake()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 9.6666
cc 2
eloc 6
nc 1
nop 0
crap 6
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\controllers;
13
14
/**
15
 * Goal for Travis CI.
16
 */
17
class TravisController extends \hidev\controllers\CommonController
18
{
19
    public $before_install;
20
    public $install;
21
    public $before_script;
22
    public $script;
23
    public $after_success;
24
    public $after_failure;
25
    public $after_script;
26
27
    public function actionMake()
28
    {
29
        $this->runActions(['before_install', 'install']);
30
        $res = $this->runActions(['before_script', 'script']);
31
        $this->runAction(static::isNotOk($res) ? 'after_failure' : 'after_success');
32
        $this->runAction('after_script');
33
34
        return $res;
35
    }
36
37
    public function actionBefore_install()
38
    {
39
        return $this->runRequests($this->before_install);
40
    }
41
42
    public function actionInstall()
43
    {
44
        return $this->runRequests($this->install);
45
    }
46
47
    public function actionBefore_script()
48
    {
49
        return $this->runRequests($this->before_script);
50
    }
51
52
    public function actionScript()
53
    {
54
        return $this->runRequests($this->script);
55
    }
56
57
    public function actionAfter_success()
58
    {
59
        return $this->runRequests($this->after_success);
60
    }
61
62
    public function actionAfter_failure()
63
    {
64
        return $this->runRequests($this->after_failure);
65
    }
66
67
    public function actionAfter_script()
68
    {
69
        return $this->runRequests($this->after_script);
70
    }
71
}
72