SrtParser\srtFile::save PHP Method

save() public method

Saves the file
public save ( string $filename = null, boolean $stripTags = false )
$filename string
$stripTags boolean If true, use file_content_notag instead of file_content
    public function save($filename = null, $stripTags = false)
    {
        if ($filename == null) {
            $filename = $this->filename;
        }
        $content = $stripTags ? $this->file_content_notag : $this->file_content;
        if (strtolower($this->encoding) != 'utf-8') {
            $file_content = mb_convert_encoding($content, $this->encoding, 'UTF-8');
        } elseif (strtolower($this->encoding) == 'utf-8' && $this->has_BOM && substr($content, 0, 3) != UTF8_BOM) {
            $file_content = UTF8_BOM . $content;
        } else {
            $file_content = $content;
        }
        $res = file_put_contents($filename, $file_content);
        if (!$res) {
            throw new \Exception('Unable to save the file.');
        }
    }