GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 7246aa...72c85e )
by Hilari
02:25
created

CodeCoverageGenerator::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
use Behat\Behat\ApplicationFactory;
4
use PhpSpec\Console\Application;
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\ArgvInput;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\ConsoleOutput;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * Class CodeCoverageGenerator
13
 */
14
class CodeCoverageGenerator extends Command
15
{
16
    protected function configure()
17
    {
18
        $this
19
            ->setName('code-coverage:generate')
20
            ->setDescription('Generates a code coverage report');
21
    }
22
23
    /**
24
     * Builds the code coverage clove report file
25
     *
26
     * @param InputInterface  $input
27
     * @param OutputInterface $output
28
     *
29
     * @return int|null|void
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        $filter = new PHP_CodeCoverage_Filter();
34
        $filter->addDirectoryToBlacklist(realpath(__DIR__.'/../console'));
35
        $filter->addDirectoryToBlacklist(realpath(__DIR__.'/../features'));
36
        $filter->addDirectoryToBlacklist(realpath(__DIR__.'/../spec'));
37
        $filter->addDirectoryToBlacklist(realpath(__DIR__.'/../vendor'));
38
39
        $coverage = new PHP_CodeCoverage(null, $filter);
40
41
        $coverage->start('<tests>');
42
        $input = new ArgvInput(['phpspec', 'run', '--format=pretty']);
43
        $app = new Application(null);
44
        $app->setAutoExit(false);
45
        $exit = $app->run($input, new ConsoleOutput());
46
        if ($exit !== 0) {
47
            exit($exit);
48
        }
49
50
        define('BEHAT_BIN_PATH', realpath(__DIR__.'/../bin/behat'));
51
        $input = new ArgvInput(['behat']);
52
        $factory = new ApplicationFactory();
53
        $app = $factory->createApplication();
54
        $app->setAutoExit(false);
55
        $exit = $app->run($input, new ConsoleOutput());
56
        if ($exit !== 0) {
57
            exit($exit);
58
        }
59
60
        $coverage->stop();
61
62
        $writer = new PHP_CodeCoverage_Report_Clover;
63
        $writer->process($coverage, realpath(__DIR__.'/..').'/clover.xml');
64
65
        $writer = new PHP_CodeCoverage_Report_HTML();
66
        $writer->process($coverage, realpath(__DIR__.'/..').'/code-coverage');
67
    }
68
}
69