4343 private Colors $ colors ;
4444 private Thresholds $ thresholds ;
4545 private CustomCssFile $ customCssFile ;
46+ private bool $ classView ;
4647
47- public function __construct (string $ generator = '' , ?Colors $ colors = null , ?Thresholds $ thresholds = null , ?CustomCssFile $ customCssFile = null )
48+ public function __construct (string $ generator = '' , ?Colors $ colors = null , ?Thresholds $ thresholds = null , ?CustomCssFile $ customCssFile = null , bool $ classView = true )
4849 {
4950 $ this ->generator = $ generator ;
5051 $ this ->colors = $ colors ?? Colors::default ();
5152 $ this ->thresholds = $ thresholds ?? Thresholds::default ();
5253 $ this ->customCssFile = $ customCssFile ?? CustomCssFile::default ();
54+ $ this ->classView = $ classView ;
5355 $ this ->templatePath = __DIR__ . '/Renderer/Template/ ' ;
5456 }
5557
@@ -60,12 +62,19 @@ public function process(DirectoryNode $report, string $target): void
6062 $ hasBranchCoverage = $ report ->numberOfExecutableBranches () > 0 ;
6163 $ hasPathCoverage = $ report ->numberOfExecutablePaths () > 0 ;
6264
63- $ builder = new Builder ;
64- $ rootNamespace = $ builder ->build ($ report );
65- $ fileToClassMap = $ this ->buildFileToClassMap ($ rootNamespace );
65+ $ fileToClassMap = [];
66+
67+ if ($ this ->classView ) {
68+ $ rootNamespace = new Builder ()->build ($ report );
69+ $ fileToClassMap = $ this ->buildFileToClassMap ($ rootNamespace );
70+ }
6671
6772 $ this ->renderFileView ($ report , $ target , $ date , $ hasBranchCoverage , $ hasPathCoverage , $ fileToClassMap );
68- $ this ->renderClassView ($ rootNamespace , $ target , $ date , $ hasBranchCoverage , $ hasPathCoverage );
73+
74+ if (isset ($ rootNamespace )) {
75+ $ this ->renderClassView ($ rootNamespace , $ target , $ date , $ hasBranchCoverage , $ hasPathCoverage );
76+ }
77+
6978 $ this ->copyFiles ($ target );
7079 $ this ->renderCss ($ target );
7180 }
@@ -81,6 +90,12 @@ private function renderFileView(DirectoryNode $report, string $target, string $d
8190
8291 $ file ->setFileToClassMap ($ fileToClassMap );
8392
93+ if (!$ this ->classView ) {
94+ $ dashboard ->disableClassView ();
95+ $ directory ->disableClassView ();
96+ $ file ->disableClassView ();
97+ }
98+
8499 $ directory ->render ($ report , $ target . 'index.html ' );
85100 $ dashboard ->render ($ report , $ target . 'dashboard.html ' );
86101
0 commit comments