Completed
Pull Request — master (#59)
by Alessandro
05:30
created

CoverageResult   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 7
dl 0
loc 60
ccs 22
cts 22
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A generateResults() 0 19 4
1
<?php
2
3
namespace Paraunit\Coverage;
4
5
use Paraunit\Proxy\Coverage\CloverResult;
6
use Paraunit\Proxy\Coverage\HtmlResult;
7
use Paraunit\Proxy\Coverage\XmlResult;
8
9
/**
10
 * Class CoverageResult
11
 * @package Paraunit\Coverage
12
 */
13
class CoverageResult
14
{
15
    /** @var  CoverageMerger */
16
    private $coverageMerger;
17
18
    /** @var  CoverageOutputPaths */
19
    private $coverageOutputPaths;
20
21
    /** @var  CloverResult */
22
    private $cloverResult;
23
24
    /** @var  XmlResult */
25
    private $xmlResult;
26
27
    /** @var  HtmlResult */
28
    private $htmlResult;
29
30
    /**
31
     * CoverageResult constructor.
32
     * @param CoverageMerger $coverageMerger
33
     * @param CoverageOutputPaths $coverageOutputPaths
34
     * @param CloverResult $cloverResult
35
     * @param XmlResult $xmlResult
36
     * @param HtmlResult $htmlResult
37
     */
38 3
    public function __construct(
39
        CoverageMerger $coverageMerger,
40
        CoverageOutputPaths $coverageOutputPaths,
41
        CloverResult $cloverResult,
42
        XmlResult $xmlResult,
43
        HtmlResult $htmlResult
44
    ) {
45
    
46 3
        $this->coverageMerger = $coverageMerger;
47 3
        $this->coverageOutputPaths = $coverageOutputPaths;
48 3
        $this->cloverResult = $cloverResult;
49 3
        $this->xmlResult = $xmlResult;
50 3
        $this->htmlResult = $htmlResult;
51 3
    }
52
53 3
    public function generateResults()
54
    {
55 3
        $coverageData = $this->coverageMerger->getCoverageData();
56
57 3
        $cloverFilePath = $this->coverageOutputPaths->getCloverFilePath();
58 3
        if (! $cloverFilePath->isEmpty()) {
59 1
            $this->cloverResult->process($coverageData, $cloverFilePath);
60 1
        }
61
62 3
        $xmlPath = $this->coverageOutputPaths->getXmlPath();
63 3
        if (! $xmlPath->isEmpty()) {
64 1
            $this->xmlResult->process($coverageData, $xmlPath);
65 1
        }
66
67 3
        $htmlPath = $this->coverageOutputPaths->getHtmlPath();
68 3
        if (! $htmlPath->isEmpty()) {
69 1
            $this->htmlResult->process($coverageData, $htmlPath);
70 1
        }
71 3
    }
72
}
73