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