Пример #1
0
 /** 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) . '&lfloor;&nbsp;';
             $depth++;
             $undefinedClass = TRUE;
         }
     }
     if ($depth > 0 && !$undefinedClass) {
         //$output .= str_repeat('   ', $depth).' └─';
         $output .= str_repeat('   ', $depth) . '&lfloor;&nbsp;';
     }
     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);
 }
Пример #2
0
 /**
  * Build the class tree branch for the given element
  *
  * @param ClassDoc[] tree
  * @param ClassDoc element
  */
 function _buildTree(array &$tree, ClassDoc $element)
 {
     $tree[$element->name()] = $element;
     if ($element->superclass()) {
         $rootDoc = $this->_doclet->rootDoc();
         $superclass = $rootDoc->classNamed($element->superclass());
         if ($superclass) {
             $this->_buildTree($tree, $superclass);
         }
     }
 }