@@ -145,8 +145,7 @@ public function __construct(Driver $driver = null, Filter $filter = null)
145
145
$ this ->driver = $ driver ;
146
146
$ this ->filter = $ filter ;
147
147
148
- $ this ->wizard = new Wizard ;
149
- $ this ->data = new ProcessedCodeCoverageData ;
148
+ $ this ->data = new ProcessedCodeCoverageData ;
150
149
}
151
150
152
151
/**
@@ -647,7 +646,7 @@ private function performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $dat
647
646
foreach ($ data ->lineCoverage () as $ file => $ _data ) {
648
647
foreach ($ _data as $ line => $ flag ) {
649
648
if ($ flag === 1 && !isset ($ allowedLines [$ file ][$ line ])) {
650
- $ unintentionallyCoveredUnits [] = $ this ->wizard ->lookup ($ file , $ line );
649
+ $ unintentionallyCoveredUnits [] = $ this ->wizard () ->lookup ($ file , $ line );
651
650
}
652
651
}
653
652
}
@@ -816,7 +815,7 @@ private function coverageToCodeUnits(RawCodeCoverageData $rawData): array
816
815
foreach ($ rawData ->lineCoverage () as $ filename => $ lines ) {
817
816
foreach ($ lines as $ line => $ flag ) {
818
817
if ($ flag === 1 ) {
819
- $ codeUnits [] = $ this ->wizard ->lookup ($ filename , $ line );
818
+ $ codeUnits [] = $ this ->wizard () ->lookup ($ filename , $ line );
820
819
}
821
820
}
822
821
}
@@ -830,10 +829,19 @@ private function linesToCodeUnits(array $data): array
830
829
831
830
foreach ($ data as $ filename => $ lines ) {
832
831
foreach ($ lines as $ line ) {
833
- $ codeUnits [] = $ this ->wizard ->lookup ($ filename , $ line );
832
+ $ codeUnits [] = $ this ->wizard () ->lookup ($ filename , $ line );
834
833
}
835
834
}
836
835
837
836
return \array_unique ($ codeUnits );
838
837
}
838
+
839
+ private function wizard (): Wizard
840
+ {
841
+ if ($ this ->wizard === null ) {
842
+ $ this ->wizard = new Wizard ;
843
+ }
844
+
845
+ return $ this ->wizard ;
846
+ }
839
847
}
0 commit comments