Skip to content

Commit

Permalink
better dot format handling
Browse files Browse the repository at this point in the history
  • Loading branch information
phcorp committed Jan 25, 2017
1 parent 11646b8 commit 8044701
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Command/DoctrinevizCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,16 @@ public function execute(InputInterface $input, OutputInterface $output)
$binary = $input->getOption('binary', null);
$path = $input->getOption('output-path', null);
$graphviz = new Graphviz($format, $binary);
if (!$path) {
if (!$path && 'dot' === $format) {
$output->writeln((string) $graph);

return 0;
} elseif (!$path) {
$graphviz->display($graph);

return 0;
} else {
return !file_put_contents($path, $graphviz->createImageData($graph));
}
$dotted = 'dot' === $format ? (string) $graph : $graphviz->createImageData($graph);
if ($path) {
return !file_put_contents($path, $dotted);
}

$output->write($dotted);
}
}

0 comments on commit 8044701

Please sign in to comment.