@@ -126,7 +126,7 @@ public function removeCoverageDataForFile(string $filename): void
126
126
/**
127
127
* @param int[] $lines
128
128
*/
129
- public function keepCoverageDataOnlyForLines (string $ filename , array $ lines ): void
129
+ public function keepLineCoverageDataOnlyForLines (string $ filename , array $ lines ): void
130
130
{
131
131
if (!isset ($ this ->lineCoverage [$ filename ])) {
132
132
return ;
@@ -136,17 +136,25 @@ public function keepCoverageDataOnlyForLines(string $filename, array $lines): vo
136
136
$ this ->lineCoverage [$ filename ],
137
137
array_flip ($ lines )
138
138
);
139
+ }
139
140
140
- if (isset ($ this ->functionCoverage [$ filename ])) {
141
- foreach ($ this ->functionCoverage [$ filename ] as $ functionName => $ functionData ) {
142
- foreach ($ functionData ['branches ' ] as $ branchId => $ branch ) {
143
- if (count (array_diff (range ($ branch ['line_start ' ], $ branch ['line_end ' ]), $ lines )) > 0 ) {
144
- unset($ this ->functionCoverage [$ filename ][$ functionName ]['branches ' ][$ branchId ]);
141
+ /**
142
+ * @param int[] $lines
143
+ */
144
+ public function keepFunctionCoverageDataOnlyForLines (string $ filename , array $ lines ): void
145
+ {
146
+ if (!isset ($ this ->functionCoverage [$ filename ])) {
147
+ return ;
148
+ }
145
149
146
- foreach ($ functionData ['paths ' ] as $ pathId => $ path ) {
147
- if (in_array ($ branchId , $ path ['path ' ], true )) {
148
- unset($ this ->functionCoverage [$ filename ][$ functionName ]['paths ' ][$ pathId ]);
149
- }
150
+ foreach ($ this ->functionCoverage [$ filename ] as $ functionName => $ functionData ) {
151
+ foreach ($ functionData ['branches ' ] as $ branchId => $ branch ) {
152
+ if (count (array_diff (range ($ branch ['line_start ' ], $ branch ['line_end ' ]), $ lines )) > 0 ) {
153
+ unset($ this ->functionCoverage [$ filename ][$ functionName ]['branches ' ][$ branchId ]);
154
+
155
+ foreach ($ functionData ['paths ' ] as $ pathId => $ path ) {
156
+ if (in_array ($ branchId , $ path ['path ' ], true )) {
157
+ unset($ this ->functionCoverage [$ filename ][$ functionName ]['paths ' ][$ pathId ]);
150
158
}
151
159
}
152
160
}
0 commit comments