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

CodeCoverageReports::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
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 CodeCoverageReports
18
{
19
    /**
20
     * @var array<string, object>
21
     */
22
    private $reports;
23
24
    /**
25
     * @param array<string, object> $reports
26
     */
27
    public function __construct(array $reports)
28
    {
29
        $this->reports = $reports;
30
    }
31
32
    /**
33
     * @return array<string, object>
34
     */
35
    public function getReports(): array
36
    {
37
        return $this->reports;
38
    }
39
40
    public function getReport(string $format): ?object
41
    {
42
        return $this->reports[$format] ?? null;
43
    }
44
45
    /**
46
     * @return array<string>
47
     */
48
    public function getAvailableFormats(): array
49
    {
50
        return array_keys($this->reports);
51
    }
52
53
    public function hasReport(string $format): bool
54
    {
55
        return isset($this->reports[$format]);
56
    }
57
58
    public function count(): int
59
    {
60
        return count($this->reports);
61
    }
62
}
63