Ejemplo n.º 1
0
 private function getDotScriptForGraph(Graph $graph)
 {
     $graphviz = new GraphViz($graph);
     return $graphviz->createScript();
 }
Ejemplo n.º 2
0
Archivo: Dot.php Proyecto: feffi/graph
 public function getOutput(Graph $graph)
 {
     $graphviz = new GraphViz($graph);
     return $graphviz->createScript();
 }
 protected function saveGraphInFile(Graph $graph, $projectName)
 {
     $localTargetFile = $this->getLocalTargetFile($projectName);
     $remoteTargetFile = $this->getRemoteTargetFile($projectName);
     $graphviz = new GraphViz($graph);
     $graphviz->setFormat($this->format);
     $tmpDir = sprintf('%s/jarvis/composer_graph_dependencies', $this->getCacheDir());
     $tmpFile = tempnam($tmpDir, 'composer_graph_dependencies');
     if ($tmpFile === false) {
         throw new UnexpectedValueException('Unable to get temporary file name for graphviz script');
     }
     $ret = file_put_contents($tmpFile, $graphviz->createScript(), LOCK_EX);
     if ($ret === false) {
         throw new UnexpectedValueException(sprintf('Unable to write graphviz script to temporary file in %s', $tmpDir));
     }
     $remoteGraphvizScriptFile = sprintf('%s/%s.%s', pathinfo($remoteTargetFile, PATHINFO_DIRNAME), pathinfo($remoteTargetFile, PATHINFO_FILENAME), 'dot');
     $this->getRemoteFilesystem()->copyLocalFileToRemote($tmpFile, $remoteGraphvizScriptFile);
     $commandLine = sprintf('%s -T %s %s -o %s', $this->graphVizExecutable, $this->format, $remoteGraphvizScriptFile, $remoteTargetFile);
     $this->getSshExec()->exec($commandLine);
     $this->getRemoteFilesystem()->copyRemoteFileToLocal($remoteTargetFile, $localTargetFile);
     return $localTargetFile;
 }