Пример #1
0
 /**
  * @return array
  */
 public function getPathAsArray()
 {
     if ($this->pathArray === null) {
         if ($this->parent === null) {
             $this->pathArray = [];
         } else {
             $this->pathArray = $this->parent->getPathAsArray();
         }
         $this->pathArray[] = $this;
     }
     return $this->pathArray;
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param string       $name
  * @param AbstractNode $parent
  * @param array        $coverageData
  * @param array        $testData
  * @param bool         $cacheTokens
  *
  * @throws InvalidArgumentException
  */
 public function __construct($name, AbstractNode $parent, array $coverageData, array $testData, $cacheTokens)
 {
     if (!is_bool($cacheTokens)) {
         throw InvalidArgumentException::create(1, 'boolean');
     }
     parent::__construct($name, $parent);
     $this->coverageData = $coverageData;
     $this->testData = $testData;
     $this->cacheTokens = $cacheTokens;
     $this->calculateStatistics();
 }
Пример #3
0
 protected function getPathToRoot(AbstractNode $node)
 {
     $id = $node->getId();
     $depth = substr_count($id, '/');
     if ($id != 'index' && $node instanceof DirectoryNode) {
         $depth++;
     }
     return str_repeat('../', $depth);
 }
Пример #4
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);
 }
Пример #5
0
 protected function getActiveBreadcrumb(AbstractNode $node)
 {
     return sprintf('        <li><a href="index.html">%s</a></li>' . "\n" . '        <li class="active">(Dashboard)</li>' . "\n", $node->getName());
 }
Пример #6
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());
 }