public function save(string $format, ?string $output)
    {
        switch ($format) {
            case self::FORMAT_PUML:
                $content = $this->generatePuml();
                break;
            case self::FORMAT_EPS:
            case self::FORMAT_PNG:
            case self::FORMAT_SVG:
                $content = $this->generateImage($format);
                break;
            default:
                throw new DiagramException(sprintf('Format "%s" not handled.', $format));
                break;
        }
        $output = $this->validateOutputLocation($format, $output);

        return file_put_contents($output, $content);
    }
public function save(string $format, ?string $output)
    {
        switch ($format) {
            case self::FORMAT_PUML:
                $content = $this->generatePuml();
                break;
            case self::FORMAT_EPS:
            case self::FORMAT_PNG:
            case self::FORMAT_SVG:
                $content = $this->generateImage($format);
                break;
            default:
                throw new DiagramException(sprintf('Format "%s" not handled.', $format));
                break;
        }
        $output = $this->validateOutputLocation($format, $output);

        return file_put_contents($output, $content);
    }
public function save ( string $ format , ? string $ output ) { switch ( $ format ) { case self :: FORMAT_PUML : $ content = $ this -> generatePuml ( ) ; break ; case self :: FORMAT_EPS : case self :: FORMAT_PNG : case self :: FORMAT_SVG : $ content = $ this -> generateImage ( $ format ) ; break ; default : throw new DiagramException ( sprintf ( 'Format "%s" not handled.' , $ format ) ) ; break ; } $ output = $ this -> validateOutputLocation ( $ format , $ output ) ; return file_put_contents ( $ output , $ content ) ; }
Saves image on disk

@param string      $format
@param null|string $output

@throws \Jawira\PhingVisualizer\DiagramException
@return int|bool The function returns the number of bytes that were written to the file, or false on failure.
Saves image on disk