Exemplo n.º 1
0
 /**
  * Injects bound in node
  *
  * @param \DOMElement $node
  * @param ResultInterface $bound
  */
 private function injectsBounds(\DOMElement $node, ResultInterface $bound)
 {
     $node->setAttribute('loc', $bound->getSum('loc'));
     $node->setAttribute('lloc', $bound->getSum('logicalLoc'));
     $node->setAttribute('cyclomaticComplexity', $bound->getAverage('cyclomaticComplexity'));
     $node->setAttribute('maintainabilityIndex', $bound->getAverage('maintainabilityIndex'));
     $node->setAttribute('volume', $bound->getAverage('volume'));
     $node->setAttribute('vocabulary', $bound->getAverage('vocabulary'));
     $node->setAttribute('difficulty', $bound->getAverage('difficulty'));
     $node->setAttribute('effort', $bound->getAverage('effort'));
     $node->setAttribute('bugs', $bound->getAverage('bugs'));
     $node->setAttribute('time', $bound->getAverage('time'));
     $node->setAttribute('intelligentContent', $bound->getAverage('intelligentContent'));
     $node->setAttribute('commentWeight', $bound->getAverage('commentWeight'));
     $node->setAttribute('length', $bound->getAverage('length'));
     $hasOOP = null !== $bound->getSum('instability');
     if ($hasOOP) {
         $node->setAttribute('lcom', $bound->getAverage('lcom'));
         $node->setAttribute('instability', $bound->getAverage('instability'));
         $node->setAttribute('efferentCoupling', $bound->getAverage('efferentCoupling'));
         $node->setAttribute('afferentCoupling', $bound->getAverage('afferentCoupling'));
         $node->setAttribute('sysc', $bound->getAverage('sysc'));
         $node->setAttribute('rsysc', $bound->getAverage('rsysc'));
         $node->setAttribute('dc', $bound->getAverage('dc'));
         $node->setAttribute('rdc', $bound->getAverage('rdc'));
         $node->setAttribute('sc', $bound->getAverage('sc'));
         $node->setAttribute('rsc', $bound->getAverage('rsc'));
         $node->setAttribute('noc', $bound->getSum('noc'));
         $node->setAttribute('noca', $bound->getSum('noca'));
         $node->setAttribute('nocc', $bound->getSum('nocc'));
         $node->setAttribute('noi', $bound->getSum('noi'));
         $node->setAttribute('nom', $bound->getSum('nom'));
     }
 }
Exemplo n.º 2
0
 /**
  * Get formated row
  *
  * @param ResultInterface $bound
  * @param string $key
  * @param string $type
  * @param integer $round
  * @return string
  */
 private function getRow(ResultInterface $bound, $key, $type, $round)
 {
     $value = $bound->get($type, $key);
     $value = !is_null($value) ? round($bound->get($type, $key), $round) : '?';
     return sprintf('<%1$s>%2$s</%1$s>', $this->getStyle($type == 'average' ? $key : null, $value), $value);
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function calculate(ResultCollection $collection, ResultCollection $groupedResults, ResultInterface $bound)
 {
     $notes = array($this->calculator->lowIsBetter(65, 154, $bound->getAverage('loc')), $this->calculator->highIsBetter(9, 30, $bound->getAverage('logicalLoc')), $this->calculator->highIsBetter(27, 59, $bound->getAverage('vocabulary')));
     return round(array_sum($notes) / count($notes, COUNT_NORMAL), 2);
 }
Exemplo n.º 4
0
 /**
  * @inheritdoc
  */
 public function calculate(ResultCollection $collection, ResultCollection $groupedResults, ResultInterface $bound)
 {
     return round($this->calculator->highIsBetter(108, 60, $bound->getAverage('maintainabilityIndex')), 2);
 }
Exemplo n.º 5
0
 /**
  * @inheritdoc
  */
 public function calculate(ResultCollection $collection, ResultCollection $groupedResults, ResultInterface $bound)
 {
     $notes = array($this->calculator->lowIsBetter(5.8, 18, $bound->getAverage('difficulty')), $this->calculator->highIsBetter(42, 32, $bound->getAverage('commentWeight')));
     return round(array_sum($notes) / count($notes, COUNT_NORMAL), 2);
 }
Exemplo n.º 6
0
 /**
  * @inheritdoc
  */
 public function calculate(ResultCollection $collection, ResultCollection $groupedResults, ResultInterface $bound)
 {
     return round($this->calculator->lowIsBetter(1, 8, $bound->getAverage('cyclomaticComplexity')), 2);
 }
Exemplo n.º 7
0
 /**
  * @inheritdoc
  */
 public function calculate(ResultCollection $collection, ResultCollection $groupedResults, ResultInterface $bound)
 {
     return round($this->calculator->lowIsBetter(0.09, 0.7, $bound->getAverage('bugs')), 2);
 }