/** * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getInterfaces * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setInterfaces */ public function testSetAndGetInterfaces() { $collection = new Collection(); $this->assertInstanceOf('phpDocumentor\\Descriptor\\Collection', $this->fixture->getInterfaces()); $this->fixture->setInterfaces($collection); $this->assertSame($collection, $this->fixture->getInterfaces()); }
/** * 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); }