/** * @param string $name * @param array $attributes * @param bool $directed * @param bool $strict * * @return $this */ public function create($name, array $attributes = [], $directed = true, $strict = true) { $this->graph = $this->createPhpDocumentorGraph(); $this->graph->setName($name); $type = $this->getType($directed); $this->graph->setType($type); $this->graph->setStrict($strict); $this->addAttributesTo($attributes, $this->graph); return $this; }
/** * Adds a subgraph to this graph; automatically changes the type to subgraph. * * Please note that an index is maintained using the name of the subgraph. * Thus if you have 2 subgraphs with the same name that the first will be * overwritten by the latter. * * @param \phpDocumentor\GraphViz\Graph $graph The graph to add onto this graph as * subgraph. * * @see \phpDocumentor\GraphViz\Graph::create() * * @return \phpDocumentor\GraphViz\Graph */ public function addGraph(\phpDocumentor\GraphViz\Graph $graph) { $graph->setType('subgraph'); $this->graphs[$graph->getName()] = $graph; return $this; }
/** * @covers phpDocumentor\GraphViz\Graph::getType */ public function testGetType() { $this->assertSame($this->fixture->getType(), 'digraph'); $this->fixture->setType('graph'); $this->assertSame($this->fixture->getType(), 'graph'); }