Passed
Push — master ( de185f...587e15 )
by Doug
07:26
created

Text   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
eloc 22
dl 0
loc 55
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 5 1
A __construct() 0 30 6
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Code Coverage Text Report.
6
 *
7
 * @copyright 2013 Anthon Pang
8
 *
9
 * @license BSD-3-Clause
10
 */
11
12
namespace DVDoug\Behat\CodeCoverage\Common\Report;
13
14
use DVDoug\Behat\CodeCoverage\Common\ReportInterface;
15
use SebastianBergmann\CodeCoverage\CodeCoverage;
16
use SebastianBergmann\CodeCoverage\Report\Text as TextReport;
17
18
/**
19
 * Text report.
20
 *
21
 * @author Anthon Pang <[email protected]>
22
 */
23
class Text implements ReportInterface
24
{
25
    /**
26
     * @var \SebastianBergmann\CodeCoverage\Report\Text
27
     */
28
    private $report;
29
30
    /**
31
     * @var array
32
     */
33
    private $options;
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function __construct(array $options)
39
    {
40
        if (!isset($options['showColors'])) {
41
            $options['showColors'] = false;
42
        }
43
44
        if (!isset($options['lowUpperBound'])) {
45
            $options['lowUpperBound'] = 50;
46
        }
47
48
        if (!isset($options['highLowerBound'])) {
49
            $options['highLowerBound'] = 90;
50
        }
51
52
        if (!isset($options['showUncoveredFiles'])) {
53
            $options['showUncoveredFiles'] = false;
54
        }
55
56
        if (!isset($options['showOnlySummary'])) {
57
            $options['showOnlySummary'] = false;
58
        }
59
60
        $this->report = new TextReport(
61
            $options['lowUpperBound'],
62
            $options['highLowerBound'],
63
            $options['showUncoveredFiles'],
64
            $options['showOnlySummary']
65
        );
66
67
        $this->options = $options;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function process(CodeCoverage $coverage)
74
    {
75
        return $this->report->process(
76
            $coverage,
77
            $this->options['showColors']
78
        );
79
    }
80
}
81