Completed
Pull Request — master (#84)
by Alessandro
02:34
created

CoverageConfiguration::loadPostCompileSettings()   D

Complexity

Conditions 8
Paths 128

Size

Total Lines 40
Code Lines 23

Duplication

Lines 16
Ratio 40 %

Code Coverage

Tests 24
CRAP Score 8

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 16
loc 40
ccs 24
cts 24
cp 1
rs 4.6666
cc 8
eloc 23
nc 128
nop 2
crap 8
1
<?php
2
3
namespace Paraunit\Configuration;
4
5
use Paraunit\Coverage\CoverageResult;
6
use Paraunit\Coverage\Processor\Clover;
7
use Paraunit\Coverage\Processor\Crap4j;
8
use Paraunit\Coverage\Processor\Html;
9
use Paraunit\Coverage\Processor\Php;
10
use Paraunit\Coverage\Processor\Text;
11
use Paraunit\Coverage\Processor\TextToConsole;
12
use Paraunit\Coverage\Processor\Xml;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
16
/**
17
 * Class CoverageConfiguration
18
 * @package Paraunit\Configuration
19
 */
20
class CoverageConfiguration extends ParallelConfiguration
21
{
22 8
    protected function loadYamlConfiguration(ContainerBuilder $containerBuilder)
23
    {
24 8
        $yamlLoader = parent::loadYamlConfiguration($containerBuilder);
25 8
        $yamlLoader->load('coverage.yml');
26 8
        $yamlLoader->load('coverage_configuration.yml');
27 8
        $yamlLoader->load('coverage_process.yml');
28 8
    }
29
30 8
    protected function loadPostCompileSettings(ContainerBuilder $container, InputInterface $input)
31
    {
32
        /** @var CoverageResult $coverageResult */
33 8
        $coverageResult = $container->get('paraunit.coverage.coverage_result');
34
35 8
        if ($input->getOption('clover')) {
36 1
            $clover = new Clover(new OutputFile($input->getOption('clover')));
37 1
            $coverageResult->addCoverageProcessor($clover);
38
        }
39
40 8 View Code Duplication
        if ($input->getOption('xml')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41 1
            $xml = new Xml(new OutputPath($input->getOption('xml')));
42 1
            $coverageResult->addCoverageProcessor($xml);
43
        }
44
45 8 View Code Duplication
        if ($input->getOption('html')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46 1
            $html = new Html(new OutputPath($input->getOption('html')));
47 1
            $coverageResult->addCoverageProcessor($html);
48
        }
49
50 8 View Code Duplication
        if ($input->getOption('text')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51 1
            $text = new Text(new OutputFile($input->getOption('text')));
52 1
            $coverageResult->addCoverageProcessor($text);
53
        }
54
55 8
        if ($input->getOption('text-to-console')) {
56 1
            $textToConsole = new TextToConsole();
57 1
            $coverageResult->addCoverageProcessor($textToConsole);
58
        }
59
60 8
        if ($input->getOption('crap4j')) {
61 1
            $crap4j = new Crap4j(new OutputFile($input->getOption('crap4j')));
62 1
            $coverageResult->addCoverageProcessor($crap4j);
63
        }
64
65 8 View Code Duplication
        if ($input->getOption('php')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66 1
            $php = new Php(new OutputFile($input->getOption('php')));
67 1
            $coverageResult->addCoverageProcessor($php);
68
        }
69 8
    }
70
}
71