@@ -28,12 +28,13 @@ public function process(PHP_CodeCoverage $coverage, $target)
2828 $ this ->processDirectory ($ report , $ this ->project );
2929
3030 $ index = $ this ->project ->asDom ();
31- $ index ->formatOutput = true ;
32- $ index ->preserveWhiteSpace = false ;
31+ $ index ->formatOutput = TRUE ;
32+ $ index ->preserveWhiteSpace = FALSE ;
3333 $ index ->save ($ target . '/index.xml ' );
3434 }
3535
36- private function initTargetDirectory ($ dir ) {
36+ private function initTargetDirectory ($ dir )
37+ {
3738 if (file_exists ($ dir )) {
3839
3940 if (!is_dir ($ dir )) {
@@ -43,15 +44,17 @@ private function initTargetDirectory($dir) {
4344 if (!is_writable ($ dir )) {
4445 throw new PHP_CodeCoverage_Exception ("' $ dir' exists but is not writable. " );
4546 }
46- } else if (!@mkdir ($ dir , 0777 , true )) {
47+ }
48+ else if (!@mkdir ($ dir , 0777 , TRUE )) {
4749 throw new PHP_CodeCoverage_Exception ("' $ dir' could not be created. " );
4850 }
4951 }
5052
51- private function processDirectory (PHP_CodeCoverage_Report_Node_Directory $ directory , PHP_CodeCoverage_Report_XML_Node $ context ) {
53+ private function processDirectory (PHP_CodeCoverage_Report_Node_Directory $ directory , PHP_CodeCoverage_Report_XML_Node $ context )
54+ {
5255 $ dirObject = $ context ->addDirectory ($ directory ->getName ());
5356 $ this ->setTotals ($ directory , $ dirObject ->getTotals ());
54- foreach ($ directory as $ node ) {
57+ foreach ($ directory as $ node ) {
5558 if ($ node instanceof PHP_CodeCoverage_Report_Node_Directory) {
5659 $ this ->processDirectory ($ node , $ dirObject );
5760 continue ;
@@ -64,42 +67,45 @@ private function processDirectory(PHP_CodeCoverage_Report_Node_Directory $direct
6467 }
6568 }
6669
67- private function processFile (PHP_CodeCoverage_Report_Node_File $ file , PHP_CodeCoverage_Report_XML_Directory $ context ) {
70+ private function processFile (PHP_CodeCoverage_Report_Node_File $ file , PHP_CodeCoverage_Report_XML_Directory $ context )
71+ {
6872 $ fileObject = $ context ->addFile ($ file ->getName (), $ file ->getId () . '.xml ' );
6973 $ this ->setTotals ($ file , $ fileObject ->getTotals ());
7074
7175 $ fileReport = new PHP_CodeCoverage_Report_XML_File_Report ($ file ->getName ());
7276 $ this ->setTotals ($ file , $ fileReport ->getTotals ());
7377
74- foreach ($ file ->getClassesAndTraits () as $ unit ) {
78+ foreach ($ file ->getClassesAndTraits () as $ unit ) {
7579 $ this ->processUnit ($ unit , $ fileReport );
7680 }
7781
78- foreach ($ file ->getFunctions () as $ function ) {
82+ foreach ($ file ->getFunctions () as $ function ) {
7983 $ this ->processFunction ($ function , $ fileReport );
8084 }
8185
82- foreach ($ file ->getCoverageData () as $ line => $ tests ) {
86+ foreach ($ file ->getCoverageData () as $ line => $ tests ) {
8387 if (!is_array ($ tests ) || count ($ tests ) == 0 ) {
8488 continue ;
8589 }
8690 $ coverage = $ fileReport ->getLineCoverage ($ line );
87- foreach ($ tests as $ test ) {
91+ foreach ($ tests as $ test ) {
8892 $ coverage ->addTest ($ test );
8993 }
9094 }
9195
9296 $ this ->initTargetDirectory ($ this ->target . dirname ($ file ->getId ()) . '/ ' );
9397 $ fileDom = $ fileReport ->asDom ();
94- $ fileDom ->formatOutput = true ;
95- $ fileDom ->preserveWhiteSpace = false ;
98+ $ fileDom ->formatOutput = TRUE ;
99+ $ fileDom ->preserveWhiteSpace = FALSE ;
96100 $ fileDom ->save ($ this ->target . $ file ->getId () . '.xml ' );
97101 }
98102
99- private function processUnit ($ unit , PHP_CodeCoverage_Report_XML_File_Report $ report ) {
103+ private function processUnit ($ unit , PHP_CodeCoverage_Report_XML_File_Report $ report )
104+ {
100105 if (isset ($ unit ['className ' ])) {
101106 $ unitObject = $ report ->getClassObject ($ unit ['className ' ]);
102- } else {
107+ }
108+ else {
103109 $ unitObject = $ report ->getTraitObject ($ unit ['traitName ' ]);
104110 }
105111
@@ -119,7 +125,7 @@ private function processUnit($unit, PHP_CodeCoverage_Report_XML_File_Report $rep
119125
120126 $ unitObject ->setNamespace ($ unit ['package ' ]['namespace ' ]);
121127
122- foreach ($ unit ['methods ' ] as $ method ) {
128+ foreach ($ unit ['methods ' ] as $ method ) {
123129 $ methodObject = $ unitObject ->addMethod ($ method ['methodName ' ]);
124130 $ methodObject ->setSignature ($ method ['signature ' ]);
125131 $ methodObject ->setLines ($ method ['startLine ' ], $ method ['endLine ' ]);
@@ -128,25 +134,28 @@ private function processUnit($unit, PHP_CodeCoverage_Report_XML_File_Report $rep
128134 }
129135 }
130136
131- private function processFunction ($ function , PHP_CodeCoverage_Report_XML_File_Report $ report ) {
137+ private function processFunction ($ function , PHP_CodeCoverage_Report_XML_File_Report $ report )
138+ {
132139 $ functionObject = $ report ->getFunctionObject ($ function ['functionName ' ]);
133140 $ functionObject ->setSignature ($ function ['signature ' ]);
134141 $ functionObject ->setLines ($ function ['startLine ' ]);
135142 $ functionObject ->setCrap ($ function ['crap ' ]);
136143 $ functionObject ->setTotals ($ function ['executableLines ' ], $ function ['executedLines ' ], $ function ['coverage ' ]);
137144 }
138145
139- private function processTests (array $ tests ) {
146+ private function processTests (array $ tests )
147+ {
140148 $ testsObject = $ this ->project ->getTests ();
141- foreach ($ tests as $ test => $ result ) {
149+ foreach ($ tests as $ test => $ result ) {
142150 if ($ test == 'UNCOVERED_FILES_FROM_WHITELIST ' ) {
143151 continue ;
144152 }
145153 $ testsObject ->addTest ($ test , $ result );
146154 }
147155 }
148156
149- private function setTotals (PHP_CodeCoverage_Report_Node $ node , PHP_CodeCoverage_Report_XML_Totals $ totals ) {
157+ private function setTotals (PHP_CodeCoverage_Report_Node $ node , PHP_CodeCoverage_Report_XML_Totals $ totals )
158+ {
150159 $ loc = $ node ->getLinesOfCode ();
151160 $ totals ->setNumLines (
152161 $ loc ['loc ' ],
@@ -177,4 +186,4 @@ private function setTotals(PHP_CodeCoverage_Report_Node $node, PHP_CodeCoverage_
177186 );
178187 }
179188
180- }
189+ }
0 commit comments