/** * Sets up test case * */ public function setUp() { $root = new RootDoc(); $root->addSourceLoader($this->getClass()->getClassLoader()); $this->fixture = $root->classNamed($this->getClassName()); }
/** Build the class hierarchy tree which is placed at the top of the page. * * @param RootDoc rootDoc The root doc * @param ClassDoc class Class to generate tree for * @param int depth Depth of recursion * @return mixed[] */ function _buildTree(RootDoc $rootDoc, ClassDoc $class, $depth = NULL) { if ($depth === NULL) { $start = TRUE; $depth = 0; } else { $start = FALSE; } $output = ''; $undefinedClass = FALSE; if ($class->superclass()) { echo "Class:" . $class->_name . " - Superclass: " . $class->superClass() . PHP_EOL; $superclass = $rootDoc->classNamed($class->superclass()); if ($superclass) { $result = $this->_buildTree($rootDoc, $superclass, $depth); $output .= $result[0]; $depth = ++$result[1]; } else { $output .= $class->superclass() . '<br>'; //$output .= str_repeat(' ', $depth).' └─'; $output .= str_repeat(' ', $depth) . '⌊ '; $depth++; $undefinedClass = TRUE; } } if ($depth > 0 && !$undefinedClass) { //$output .= str_repeat(' ', $depth).' └─'; $output .= str_repeat(' ', $depth) . '⌊ '; } if ($start) { $output .= '<strong>' . $class->name() . '</strong><br />'; } else { $output .= '<a href="' . str_repeat('../', $this->_depth) . $class->asPath() . '">' . $class->name() . '</a><br>'; } return array($output, $depth); }