|
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
|
|
|
|