Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to use custom save filename #104

Closed
gavin310 opened this issue Nov 17, 2017 · 1 comment
Closed

Ability to use custom save filename #104

gavin310 opened this issue Nov 17, 2017 · 1 comment

Comments

@gavin310
Copy link

I needed to use a specific format for the filename, but didn't see a way to do this. I changed the save function to accept an optional $filename parameter. Maybe this functionality could be properly added?

/**
 * Save to a file
 *
 * @param string [optional] $filename
 * @return void
 */
public function save($filename = null)
{
    if ($filename)
        $file = $filename;
    else
        $file = $this->getFilename() . '.' . $this->getFileExtension();

    // Add save path if given
    if (null !== $this->savePath) {
        $file = $this->savePath . $file;
    }

    file_put_contents(
        $file,
        $this->getOutput()
    );
}
@jeroendesloovere
Copy link
Owner

Closing this one since there is already a method for renaming the filename: setFilename($value, $overwrite = true, $separator = '_')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants