Completed
Push — master ( 633e5a...9cc31f )
by Andrii
16:02
created

ScrutinizerController::actionRunOcularPhp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * Scrutinizer plugin for HiDev
5
 *
6
 * @link      https://github.com/hiqdev/hidev-scrutinizer
7
 * @package   hidev-scrutinizer
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\scrutinizer\controllers;
13
14
/**
15
 * Goal for Scrutinizer.
16
 */
17
class ScrutinizerController extends \hidev\controllers\CommonController
18
{
19
    public function getLanguage()
20
    {
21
        return $this->takeGoal('.travis.yml')->getItem('language');
22
    }
23
24
    public function actionUploadCoverage()
25
    {
26
        $lang = $this->getLanguage();
27
        return $this->runActions(["get-ocular-$lang", "run-ocular-$lang"]);
28
    }
29
30
    public function actionGetOcularPhp()
31
    {
32
        if (file_exists('ocular.phar')) {
33
            return 0;
34
        }
35
36
        return $this->passthru('wget', 'https://scrutinizer-ci.com/ocular.phar');
37
    }
38
39
    public function actionRunOcularPhp()
40
    {
41
        return $this->passthru('ocular', ['code-coverage:upload', '--format=php-clover', 'coverage.clover']);
42
    }
43
44
    public function actionGetOcularPython()
45
    {
46
        return null;
47
    }
48
49
    public function actionRunOcularPython()
50
    {
51
        return $this->passthru('ocular', ['--data-file', '.coverage']);
52
    }
53
}
54