@@ -15,7 +15,7 @@ trait ScoreCalculator
1515
1616 /**
1717 * Return true if score is enable by the config file
18- * @return type
18+ * @return boolean
1919 */
2020 public function isScoreEnable ()
2121 {
@@ -35,10 +35,14 @@ protected function calculateScore()
3535
3636 $ loc = (int ) $ this ->oAnalyze ->getLoc ();
3737 $ cs = (int ) ($ this ->oAnalyze ->getCsSuccess () === true );
38+ $ cp = (int ) ($ this ->oAnalyze ->getCpSuccess () === true );
39+ $ sc = (int ) ($ this ->oAnalyze ->getSecuritySuccess () === true );
3840 $ test = (int ) ($ this ->oAnalyze ->getTuSuccess () === true );
3941 $ cc = (float ) $ this ->oAnalyze ->getCov ();
4042
4143 $ csWeight = $ this ->getScoreWeightParam ('csWeight ' );
44+ $ cpWeight = $ this ->getScoreWeightParam ('cpWeight ' );
45+ $ scWeight = $ this ->getScoreWeightParam ('scWeight ' );
4246 $ testWeight = $ this ->getScoreWeightParam ('testWeight ' );
4347 $ locWeight = $ this ->getScoreWeightParam ('locWeight ' );
4448
@@ -53,22 +57,27 @@ protected function calculateScore()
5357 $ maxSize = 100000 ;
5458 }
5559
56- $ note = $ cs * $ csWeight + $ test * $ testWeight * ($ cc / 100 ) + $ loc * $ locWeight / $ maxSize ;
57- $ divide = ($ csWeight + $ testWeight + $ locWeight ) / 20 ;
60+ $ note =
61+ $ cp * $ cpWeight +
62+ $ sc * $ scWeight +
63+ $ cs * $ csWeight +
64+ $ test * $ testWeight * ($ cc / 100 ) +
65+ $ loc * $ locWeight / $ maxSize ;
66+ $ divide = ($ csWeight + $ scWeight + $ cpWeight + $ testWeight + $ locWeight ) / 20 ;
5867 $ score = round (($ note / $ divide ), 2 );
5968
6069 $ this ->oAnalyze ->setScore ($ score );
6170 }
6271
6372 /**
6473 * Return weight of the given parameter
65- * @param type $name
74+ * @param string $name
6675 * @return int
6776 */
6877 public function getScoreWeightParam ($ name )
6978 {
7079 $ weight = $ this ->getParam ('score ' , $ name );
71- if (!is_int ($ weight )) {
80+ if (!is_numeric ($ weight )) {
7281 return 100 ;
7382 }
7483
0 commit comments