@@ -106,10 +106,10 @@ public function process(PHP_CodeCoverage $coverage, $target = NULL, $name = NULL
106
106
$ methodNode ->appendChild ($ document ->createElement ('methodName ' , $ methodName ));
107
107
$ methodNode ->appendChild ($ document ->createElement ('methodSignature ' , htmlspecialchars ($ method ['signature ' ])));
108
108
$ methodNode ->appendChild ($ document ->createElement ('fullMethod ' , htmlspecialchars ($ method ['signature ' ])));
109
- $ methodNode ->appendChild ($ document ->createElement ('crap ' , $ crap ));
109
+ $ methodNode ->appendChild ($ document ->createElement ('crap ' , $ this -> roundValue ( $ crap) ));
110
110
$ methodNode ->appendChild ($ document ->createElement ('complexity ' , $ method ['ccn ' ]));
111
- $ methodNode ->appendChild ($ document ->createElement ('coverage ' , $ coveragePercent ));
112
- $ methodNode ->appendChild ($ document ->createElement ('crapLoad ' , $ crapLoad ));
111
+ $ methodNode ->appendChild ($ document ->createElement ('coverage ' , $ this -> roundValue ( $ coveragePercent) ));
112
+ $ methodNode ->appendChild ($ document ->createElement ('crapLoad ' , round ( $ crapLoad) ));
113
113
114
114
$ methodsNode ->appendChild ($ methodNode );
115
115
@@ -127,9 +127,9 @@ public function process(PHP_CodeCoverage $coverage, $target = NULL, $name = NULL
127
127
128
128
$ stats ->appendChild ($ document ->createElement ('methodCount ' , $ fullMethodCount ));
129
129
$ stats ->appendChild ($ document ->createElement ('crapMethodCount ' , $ fullCrapMethodCount ));
130
- $ stats ->appendChild ($ document ->createElement ('crapLoad ' , $ fullCrapLoad ));
130
+ $ stats ->appendChild ($ document ->createElement ('crapLoad ' , round ( $ fullCrapLoad) ));
131
131
$ stats ->appendChild ($ document ->createElement ('totalCrap ' , $ fullCrap ));
132
- $ stats ->appendChild ($ document ->createElement ('crapMethodPercent ' , 100 * $ fullCrapMethodCount / $ fullMethodCount ));
132
+ $ stats ->appendChild ($ document ->createElement ('crapMethodPercent ' , $ this -> roundValue ( 100 * $ fullCrapMethodCount / $ fullMethodCount) ));
133
133
134
134
$ root ->appendChild ($ stats );
135
135
$ root ->appendChild ($ methodsNode );
@@ -196,4 +196,9 @@ public function getCrapLoad($crapValue, $cyclomaticComplexity, $coveragePercent)
196
196
}
197
197
return $ crapLoad ;
198
198
}
199
+
200
+ private function roundValue ($ value )
201
+ {
202
+ return round ($ value , 2 );
203
+ }
199
204
}
0 commit comments