src/Annotations/OpenApi.php
public function saveAs($filename, $format = 'auto')
    {

        if ($format === 'auto') {
            $format =   strtolower(substr($filename, -5)) === '.json' ? 'json' : 'yaml';
        }
        if (strtolower($format) === 'json') {
            $content = $this->toJson();
        } else {
            $content = $this->toYaml();
        }
        if (file_put_contents($filename, $content) === false) {
            throw new Exception('Failed to saveAs("' . $filename . '", "'.$format.'")');
        }
    }
public function saveAs($filename, $format = 'auto')
    {

        if ($format === 'auto') {
            $format =   strtolower(substr($filename, -5)) === '.json' ? 'json' : 'yaml';
        }
        if (strtolower($format) === 'json') {
            $content = $this->toJson();
        } else {
            $content = $this->toYaml();
        }
        if (file_put_contents($filename, $content) === false) {
            throw new Exception('Failed to saveAs("' . $filename . '", "'.$format.'")');
        }
    }
public function saveAs ( $ filename , $ format = 'auto' ) { if ( $ format === 'auto' ) { $ format = strtolower ( substr ( $ filename , - 5 ) ) === '.json' ? 'json' : 'yaml' ; } if ( strtolower ( $ format ) === 'json' ) { $ content = $ this -> toJson ( ) ; } else { $ content = $ this -> toYaml ( ) ; } if ( file_put_contents ( $ filename , $ content ) === false ) { throw new Exception ( 'Failed to saveAs("' . $ filename . '", "' . $ format . '")' ) ; } }
Save the OpenAPI documentation to a file.

@param  string $filename
@throws Exception
Save the OpenAPI documentation to a file .