1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the doyo/code-coverage project. |
5
|
|
|
* |
6
|
|
|
* (c) Anthonius Munthi <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Doyo\Bridge\CodeCoverage\Event; |
15
|
|
|
|
16
|
|
|
use Doyo\Bridge\CodeCoverage\Console\ConsoleIO; |
17
|
|
|
use Doyo\Bridge\CodeCoverage\Environment\RuntimeInterface; |
18
|
|
|
use Doyo\Bridge\CodeCoverage\ProcessorInterface; |
19
|
|
|
use Doyo\Symfony\Bridge\EventDispatcher\Event; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class CoverageEvent. |
23
|
|
|
* |
24
|
|
|
* @method bool canCollectCodeCoverage() |
25
|
|
|
* @method string getDriverClass() |
26
|
|
|
*/ |
27
|
|
|
class CoverageEvent extends Event |
28
|
|
|
{ |
29
|
|
|
const refresh = 'refresh'; |
30
|
|
|
const beforeStart = 'beforeStart'; |
31
|
|
|
const start = 'start'; |
32
|
|
|
const stop = 'stop'; |
33
|
|
|
const complete = 'complete'; |
34
|
|
|
const report = 'report'; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var ProcessorInterface |
38
|
|
|
*/ |
39
|
|
|
private $processor; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var ConsoleIO |
43
|
|
|
*/ |
44
|
|
|
private $consoleIO; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var RuntimeInterface |
48
|
|
|
*/ |
49
|
|
|
private $runtime; |
50
|
|
|
|
51
|
10 |
|
public function __construct( |
52
|
|
|
ProcessorInterface $processor, |
53
|
|
|
ConsoleIO $consoleIO, |
54
|
|
|
RuntimeInterface $runtime |
55
|
|
|
) { |
56
|
10 |
|
$this->processor = $processor; |
57
|
10 |
|
$this->consoleIO = $consoleIO; |
58
|
10 |
|
$this->runtime = $runtime; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return ProcessorInterface |
63
|
|
|
*/ |
64
|
97 |
|
public function getProcessor(): ProcessorInterface |
65
|
|
|
{ |
66
|
97 |
|
return $this->processor; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return ConsoleIO |
71
|
|
|
*/ |
72
|
4 |
|
public function getConsoleIO(): ConsoleIO |
73
|
|
|
{ |
74
|
4 |
|
return $this->consoleIO; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return RuntimeInterface |
79
|
|
|
*/ |
80
|
1 |
|
public function getRuntime(): RuntimeInterface |
81
|
|
|
{ |
82
|
1 |
|
return $this->runtime; |
83
|
|
|
} |
84
|
|
|
|
85
|
97 |
|
public function __call($name, $arguments) |
86
|
|
|
{ |
87
|
97 |
|
return \call_user_func_array([$this->runtime, $name], $arguments); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|