| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public function getImage($dotContent) { |
||
| 39 | |||
| 40 | $this->checkInstallation(); |
||
| 41 | |||
| 42 | $dotFile = tempnam(sys_get_temp_dir(), 'phpmetrics-graphviz'); |
||
| 43 | $imageFile = tempnam(sys_get_temp_dir(), 'phpmetrics-graphviz'); |
||
| 44 | |||
| 45 | // dot file |
||
| 46 | $dotContent = str_replace('\\', '/', $dotContent); |
||
| 47 | file_put_contents($dotFile, $dotContent); |
||
| 48 | |||
| 49 | // image |
||
| 50 | shell_exec(sprintf('circo -Lg -Tsvg -o%2$s %1$s 2>&1', $dotFile, $imageFile)); |
||
| 51 | $content = file_get_contents($imageFile); |
||
| 52 | unlink($imageFile); |
||
| 53 | unlink($dotFile); |
||
| 54 | return $content; |
||
| 55 | } |
||
| 56 | } |