/** * @param PHP_CodeCoverage_Report_Node_Directory $root * @param array $items * @param array $tests * @param boolean $cacheTokens */ private function addItems(Directory $root, array $items) { foreach ($items as $key => $value) { if (substr($key, -2) == '/f') { $key = substr($key, 0, -2); if (file_exists($root->getPath() . DIRECTORY_SEPARATOR . $key)) { $root->addFile($key, $value); } } else { $child = $root->addDirectory($key); $this->addItems($child, $value); } } }
/** * @param PHP_CodeCoverage_Report_Node_Directory $node * @param string $file */ public function render(\DavM85\BusFactor\Node\Directory $node, $file) { // $this->setCommonTemplateVariables($template, $node); $items = array(); // $items[] = $this->renderItem($node, true); foreach ($node->getDirectories() as $item) { $items[] = $this->renderItem($item); } foreach ($node->getFiles() as $item) { $items[] = $this->renderItem($item); } $data = array('id' => $node->getId(), 'items' => $items, 'breadcrumbs' => $this->getBreadcrumbs($node)); $html = $this->twig->render('directory.htm.twig', $data); file_put_contents($file, $html); }