/**
  * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct
  * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getChildren
  * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setChildren
  */
 public function testSetAndGetChildren()
 {
     $collection = new Collection();
     $this->assertInstanceOf('phpDocumentor\\Descriptor\\Collection', $this->fixture->getChildren());
     $this->fixture->setChildren($collection);
     $this->assertSame($collection, $this->fixture->getChildren());
 }
Esempio n. 2
0
 /**
  * Builds a tree of namespace subgraphs with their classes associated.
  *
  * @param GraphVizGraph       $graph
  * @param NamespaceDescriptor $namespace
  *
  * @return void
  */
 protected function buildNamespaceTree(GraphVizGraph $graph, NamespaceDescriptor $namespace)
 {
     $full_namespace_name = $namespace->getFullyQualifiedStructuralElementName();
     if ($full_namespace_name == '\\') {
         $full_namespace_name = 'Global';
     }
     $sub_graph = GraphVizGraph::create('cluster_' . $full_namespace_name)->setLabel($namespace->getName() == '\\' ? 'Global' : $namespace->getName())->setStyle('rounded')->setColor('gray')->setFontColor('gray')->setFontSize('11')->setRankDir('LR');
     $elements = array_merge($namespace->getClasses()->getAll(), $namespace->getInterfaces()->getAll(), $namespace->getTraits()->getAll());
     /** @var ClassDescriptor|InterfaceDescriptor|TraitDescriptor $sub_element */
     foreach ($elements as $sub_element) {
         $node = Node::create($sub_element->getFullyQualifiedStructuralElementName(), $sub_element->getName())->setShape('box')->setFontName($this->nodeFont)->setFontSize('11');
         if ($sub_element instanceof ClassDescriptor && $sub_element->isAbstract()) {
             $node->setLabel('<«abstract»<br/>' . $sub_element->getName() . '>');
         }
         //$full_name = $sub_element->getFullyQualifiedStructuralElementName();
         //$node->setURL($this->class_paths[$full_name]);
         //$node->setTarget('_parent');
         $this->nodeCache[$sub_element->getFullyQualifiedStructuralElementName()] = $node;
         $sub_graph->setNode($node);
     }
     foreach ($namespace->getChildren()->getAll() as $element) {
         $this->buildNamespaceTree($sub_graph, $element);
     }
     $graph->addGraph($sub_graph);
 }