Beispiel #1
0
 /**
  * @param Node $node
  * @param bool $total
  *
  * @return string
  */
 protected function renderItem(Node $node, $total = false)
 {
     $data = ['numClasses' => $node->getNumClassesAndTraits(), 'numTestedClasses' => $node->getNumTestedClassesAndTraits(), 'numMethods' => $node->getNumMethods(), 'numTestedMethods' => $node->getNumTestedMethods(), 'linesExecutedPercent' => $node->getLineExecutedPercent(false), 'linesExecutedPercentAsString' => $node->getLineExecutedPercent(), 'numExecutedLines' => $node->getNumExecutedLines(), 'numExecutableLines' => $node->getNumExecutableLines(), 'testedMethodsPercent' => $node->getTestedMethodsPercent(false), 'testedMethodsPercentAsString' => $node->getTestedMethodsPercent(), 'testedClassesPercent' => $node->getTestedClassesAndTraitsPercent(false), 'testedClassesPercentAsString' => $node->getTestedClassesAndTraitsPercent()];
     if ($total) {
         $data['name'] = 'Total';
     } else {
         if ($node instanceof DirectoryNode) {
             $data['name'] = sprintf('<a href="%s/index.html">%s</a>', $node->getName(), $node->getName());
             $data['icon'] = '<span class="glyphicon glyphicon-folder-open"></span> ';
         } else {
             $data['name'] = sprintf('<a href="%s.html">%s</a>', $node->getName(), $node->getName());
             $data['icon'] = '<span class="glyphicon glyphicon-file"></span> ';
         }
     }
     return $this->renderItemTemplate(new \Text_Template($this->templatePath . 'directory_item.html', '{{', '}}'), $data);
 }
Beispiel #2
0
 private function setTotals(AbstractNode $node, Totals $totals)
 {
     $loc = $node->getLinesOfCode();
     $totals->setNumLines($loc['loc'], $loc['cloc'], $loc['ncloc'], $node->getNumExecutableLines(), $node->getNumExecutedLines());
     $totals->setNumClasses($node->getNumClasses(), $node->getNumTestedClasses());
     $totals->setNumTraits($node->getNumTraits(), $node->getNumTestedTraits());
     $totals->setNumMethods($node->getNumMethods(), $node->getNumTestedMethods());
     $totals->setNumFunctions($node->getNumFunctions(), $node->getNumTestedFunctions());
 }