@@ -602,13 +602,24 @@ private function initializeFilesThatAreSeenTheFirstTime(array $data)
602
602
603
603
$ this ->data [$ file ] = ['lines ' => []];
604
604
605
+ foreach ($ fileData ['lines ' ] as $ lineNumber => $ flag ) {
606
+ if ($ flag === PHP_CodeCoverage_Driver::LINE_NOT_EXECUTABLE ) {
607
+ $ this ->data [$ file ]['lines ' ][$ lineNumber ] = null ;
608
+ } else {
609
+ $ this ->data [$ file ]['lines ' ][$ lineNumber ] = [
610
+ 'pathCovered ' => false ,
611
+ 'tests ' => [],
612
+ ];
613
+ }
614
+ }
615
+
605
616
if ($ this ->pathCoverage ) {
606
617
$ this ->data [$ file ]['branches ' ] = [];
607
618
$ this ->data [$ file ]['paths ' ] = [];
608
619
609
620
foreach ($ fileData ['functions ' ] as $ functionName => $ functionData ) {
610
621
$ this ->data [$ file ]['branches ' ][$ functionName ] = [];
611
- $ this ->data [$ file ]['paths ' ][$ functionName ] = [ ];
622
+ $ this ->data [$ file ]['paths ' ][$ functionName ] = $ functionData [ ' paths ' ];
612
623
613
624
foreach ($ functionData ['branches ' ] as $ index => $ branch ) {
614
625
$ this ->data [$ file ]['branches ' ][$ functionName ][$ index ] = [
@@ -617,30 +628,11 @@ private function initializeFilesThatAreSeenTheFirstTime(array $data)
617
628
'line_end ' => $ branch ['line_end ' ],
618
629
'tests ' => []
619
630
];
620
- }
621
-
622
- foreach ($ functionData ['paths ' ] as $ path ) {
623
- $ this ->data [$ file ]['paths ' ][$ functionName ][] = $ path ;
624
- }
625
- }
626
- }
627
-
628
- foreach ($ fileData ['lines ' ] as $ lineNumber => $ flag ) {
629
- if ($ flag === PHP_CodeCoverage_Driver::LINE_NOT_EXECUTABLE ) {
630
- $ this ->data [$ file ]['lines ' ][$ lineNumber ] = null ;
631
- } else {
632
- $ this ->data [$ file ]['lines ' ][$ lineNumber ] = [
633
- 'pathCovered ' => false ,
634
- 'tests ' => [],
635
- ];
636
- }
637
- }
638
631
639
- foreach ($ this ->data [$ file ]['branches ' ] as $ function ) {
640
- foreach ($ function as $ branch ) {
641
- for ($ i = $ branch ['line_start ' ]; $ i < $ branch ['line_end ' ]; $ i ++) {
642
- if (isset ($ this ->data [$ file ]['lines ' ][$ i ])) {
643
- $ this ->data [$ file ]['lines ' ][$ i ]['pathCovered ' ] = (bool ) $ branch ['hit ' ];
632
+ for ($ i = $ branch ['line_start ' ]; $ i < $ branch ['line_end ' ]; $ i ++) {
633
+ if (isset ($ this ->data [$ file ]['lines ' ][$ i ])) {
634
+ $ this ->data [$ file ]['lines ' ][$ i ]['pathCovered ' ] = (bool ) $ branch ['hit ' ];
635
+ }
644
636
}
645
637
}
646
638
}
0 commit comments