@@ -184,56 +184,23 @@ public function process(PHP_CodeCoverage $coverage, $showColors = FALSE)
184184 }
185185
186186 $ classes = $ item ->getClassesAndTraits ();
187- $ coverage = $ item ->getCoverageData ();
188- $ lines = array ();
189187
190188 foreach ($ classes as $ className => $ class ) {
191189 $ classStatements = 0 ;
192190 $ coveredClassStatements = 0 ;
193191 $ coveredMethods = 0 ;
192+ $ classMethods = 0 ;
194193
195194 foreach ($ class ['methods ' ] as $ method ) {
196- $ methodCount = 0 ;
197- $ methodLines = 0 ;
198- $ methodLinesCovered = 0 ;
199-
200- for ($ i = $ method ['startLine ' ];
201- $ i <= $ method ['endLine ' ];
202- $ i ++) {
203- $ add = TRUE ;
204- $ count = 0 ;
205-
206- if (isset ($ coverage [$ i ])) {
207- if ($ coverage [$ i ] !== NULL ) {
208- $ classStatements ++;
209- $ methodLines ++;
210- } else {
211- $ add = FALSE ;
212- }
213-
214- $ count = count ($ coverage [$ i ]);
215-
216- if ($ count > 0 ) {
217- $ coveredClassStatements ++;
218- $ methodLinesCovered ++;
219- }
220- } else {
221- $ add = FALSE ;
222- }
223-
224- $ methodCount = max ($ methodCount , $ count );
225-
226- if ($ add ) {
227- $ lines [$ i ] = array (
228- 'count ' => $ count , 'type ' => 'stmt '
229- );
230- }
231- }
195+ if ($ method ['executableLines ' ] == 0 )
196+ continue ;
232197
233- if ($ methodCount > 0 ) {
198+ $ classMethods ++;
199+ $ classStatements += $ method ['executableLines ' ];
200+ $ coveredClassStatements += $ method ['executedLines ' ];
201+ if ($ method ['coverage ' ] == 100 ){
234202 $ coveredMethods ++;
235203 }
236-
237204 }
238205
239206 if (!empty ($ class ['package ' ]['namespace ' ])) {
@@ -252,7 +219,7 @@ public function process(PHP_CodeCoverage $coverage, $showColors = FALSE)
252219 'namespace ' => $ namespace ,
253220 'className ' => $ className ,
254221 'methodsCovered ' => $ coveredMethods ,
255- 'methodCount ' => count ( $ class [ ' methods ' ]) ,
222+ 'methodCount ' => $ classMethods ,
256223 'statementsCovered ' => $ coveredClassStatements ,
257224 'statementCount ' => $ classStatements ,
258225 );
0 commit comments