src/Export/Writer/GraphvizWriter.php
protected function generateGraphvizOutputFile(
        string $graphvizCode,
        string $targetFile,
        array $graphvizOptions = []
    ): GraphvizWriter
    {
        $graphvizOptions = array_replace_recursive(
            [
                'targetType'            => 'png'
            ],
            $graphvizOptions
        );
        $tmpFile = $targetFile.'.tmp';

        $this->removeFile($targetFile)
            ->removeFile($tmpFile);

        $this->writeFile($graphvizCode, $tmpFile);

        exec('dot -T'.$graphvizOptions['targetType'].' '.$tmpFile.' -o '.$targetFile, $output, $status);

        if ($status) {
            throw ExportException::create(
                'Couldn\'t generate Graphviz image. Exit Code: '.$status.' - Output: '.print_r($output, true)
            );
        }

        $this->removeFile($tmpFile);

        return $this;
    }
protected function generateGraphvizOutputFile(
        string $graphvizCode,
        string $targetFile,
        array $graphvizOptions = []
    ): GraphvizWriter
    {
        $graphvizOptions = array_replace_recursive(
            [
                'targetType'            => 'png'
            ],
            $graphvizOptions
        );
        $tmpFile = $targetFile.'.tmp';

        $this->removeFile($targetFile)
            ->removeFile($tmpFile);

        $this->writeFile($graphvizCode, $tmpFile);

        exec('dot -T'.$graphvizOptions['targetType'].' '.$tmpFile.' -o '.$targetFile, $output, $status);

        if ($status) {
            throw ExportException::create(
                'Couldn\'t generate Graphviz image. Exit Code: '.$status.' - Output: '.print_r($output, true)
            );
        }

        $this->removeFile($tmpFile);

        return $this;
    }
protected function generateGraphvizOutputFile ( string $ graphvizCode , string $ targetFile , array $ graphvizOptions = [ ] ) : GraphvizWriter { $ graphvizOptions = array_replace_recursive ( [ 'targetType' => 'png' ] , $ graphvizOptions ) ; $ tmpFile = $ targetFile . '.tmp' ; $ this -> removeFile ( $ targetFile ) -> removeFile ( $ tmpFile ) ; $ this -> writeFile ( $ graphvizCode , $ tmpFile ) ; exec ( 'dot -T' . $ graphvizOptions [ 'targetType' ] . ' ' . $ tmpFile . ' -o ' . $ targetFile , $ output , $ status ) ; if ( $ status ) { throw ExportException :: create ( 'Couldn\'t generate Graphviz image. Exit Code: ' . $ status . ' - Output: ' . print_r ( $ output , true ) ) ; } $ this -> removeFile ( $ tmpFile ) ; return $ this ; }
Exports a graphviz code to a file.

@param string $graphvizCode    - Graphviz code.
@param string $targetFile      - Target file.
@param array  $graphvizOptions - Graphviz options.

@throws ExportException

@return GraphvizWriter
Exports a graphviz code to a file .