1 | <?php |
||
10 | class CoverageCheck |
||
11 | { |
||
12 | /** |
||
13 | * @var DiffFileLoader |
||
14 | */ |
||
15 | protected $diff; |
||
16 | /** |
||
17 | * @var FileChecker |
||
18 | */ |
||
19 | protected $fileChecker; |
||
20 | /** |
||
21 | * @var FileMatcher |
||
22 | */ |
||
23 | protected $matcher; |
||
24 | /** |
||
25 | * @var stdClass |
||
26 | */ |
||
27 | protected $cache; |
||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $uncoveredLines = []; |
||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $coveredLines = []; |
||
36 | |||
37 | /** |
||
38 | * CoverageCheck constructor. |
||
39 | * This class is used for filtering the "checker" by the diff |
||
40 | * For example if the checker is phpunit, this class filters the phpunit |
||
41 | * output by the diff of the pull request. giving only the common lines in |
||
42 | * each |
||
43 | * |
||
44 | * @param DiffFileLoader $diff |
||
45 | * @param FileChecker $fileChecker |
||
46 | * @param FileMatcher $matcher |
||
47 | */ |
||
48 | public function __construct( |
||
58 | |||
59 | /** |
||
60 | * array of uncoveredLines and coveredLines |
||
61 | * @return array |
||
62 | */ |
||
63 | public function getCoveredLines() |
||
86 | |||
87 | /** |
||
88 | * @param string $file the filename containing the uncovered line |
||
89 | * @param int $line the number of the uncovered line |
||
90 | * @param string $message the message showing why its uncovered |
||
91 | */ |
||
92 | protected function addUnCoveredLine($file, $line, $message) |
||
100 | |||
101 | /** |
||
102 | * @param string $file the filename containing the covered line |
||
103 | * @param int $line the number of the covered line |
||
104 | */ |
||
105 | protected function addCoveredLine($file, $line) |
||
113 | |||
114 | /** |
||
115 | * @param string $fileName the file name in the diff |
||
116 | * @param string $matchedFile the file name of the matched file |
||
117 | */ |
||
118 | protected function matchLines($fileName, $matchedFile) |
||
144 | |||
145 | protected function addCoveredFile($file) |
||
151 | |||
152 | protected function addUnCoveredFile($file) |
||
158 | |||
159 | protected function getDiff() |
||
167 | |||
168 | protected function getCoverage() |
||
176 | |||
177 | protected function handleFileNotFound($file) |
||
189 | |||
190 | protected function findFile($file, $coveredFiles) |
||
199 | } |
||
200 |