Completed
Push — master ( 2ccc35...e29538 )
by Stéphane
20s queued 18s
created

CodeCoverageOptions::getFormats()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * This file is part of the friends-of-phpspec/phpspec-code-coverage package.
5
 *
6
 * @author ek9 <[email protected]>
7
 * @license MIT
8
 *
9
 * For the full copyright and license information, please see the LICENSE file
10
 * that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace FriendsOfPhpSpec\PhpSpec\CodeCoverage;
16
17
class CodeCoverageOptions
18
{
19
    /**
20
     * @var array<string, mixed>
21
     */
22
    private $options;
23
24
    /**
25
     * @param array<string, mixed> $options
26
     */
27 5
    public function __construct(array $options)
28
    {
29 5
        $this->options = $options;
30
    }
31
32
    /**
33
     * @return array<string, mixed>
34
     */
35
    public function getOptions(): array
36
    {
37
        return $this->options;
38
    }
39
40
    /**
41
     * @return mixed
42
     */
43
    public function get(string $key)
44
    {
45
        return $this->options[$key] ?? null;
46
    }
47
48
    /**
49
     * @param mixed $default
50
     *
51
     * @return mixed
52
     */
53
    public function getWithDefault(string $key, $default)
54
    {
55
        return $this->options[$key] ?? $default;
56
    }
57
58
    /**
59
     * @return array<string>
60
     */
61 2
    public function getFormats(): array
62
    {
63 2
        return $this->options['format'] ?? ['html'];
64
    }
65
66
    /**
67
     * @return array<string, string>
68
     */
69 1
    public function getOutputPaths(): array
70
    {
71 1
        return $this->options['output'] ?? [];
72
    }
73
74
    /**
75
     * @return bool
76
     */
77
    public function showUncoveredFiles(): bool
78
    {
79
        return $this->options['show_uncovered_files'] ?? true;
80
    }
81
82
    /**
83
     * @return int
84
     */
85
    public function getLowerUpperBound(): int
86
    {
87
        return $this->options['lower_upper_bound'] ?? 35;
88
    }
89
90
    /**
91
     * @return int
92
     */
93
    public function getHighLowerBound(): int
94
    {
95
        return $this->options['high_lower_bound'] ?? 70;
96
    }
97
98
    /**
99
     * @return bool
100
     */
101 2
    public function showOnlySummary(): bool
102
    {
103 2
        return $this->options['show_only_summary'] ?? false;
104
    }
105
}
106