-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathReportService.php
More file actions
61 lines (53 loc) · 1.29 KB
/
ReportService.php
File metadata and controls
61 lines (53 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Code Coverage Report Service
*
* @copyright 2013 Anthon Pang
*
* @license BSD-2-Clause
*/
namespace LeanPHP\Behat\CodeCoverage\Service;
use LeanPHP\Behat\CodeCoverage\Common\Report\Factory;
use SebastianBergmann\CodeCoverage\CodeCoverage;
/**
* Code coverage report service
*
* @author Anthon Pang <apang@softwaredevelopment.ca>
*/
class ReportService
{
/**
* @var array
*/
private $config;
/**
* @var \LeanPHP\Behat\CodeCoverage\Common\Report\Factory
*/
private $factory;
/**
* Constructor
*
* @param array $config
* @param \LeanPHP\Behat\CodeCoverage\Common\Report\Factory $factory
*/
public function __construct(array $config, Factory $factory)
{
$this->config = $config;
$this->factory = $factory;
}
/**
* Generate report
*
* @param CodeCoverage $coverage
*/
public function generateReport(CodeCoverage $coverage)
{
$format = $this->config['report']['format'];
$options = $this->config['report']['options'];
$report = $this->factory->create($format, $options);
$output = $report->process($coverage);
if ('text' === $format) {
print_r($output);
}
}
}