TemplateConverter::write PHP Method

write() public method

Output file might be either the given as parameter or the original file.
public write ( string $p_templateFileName = null ) : boolean
$p_templateFileName string File name for the template after conversion, default is the original template file name
return boolean True on success, false on failure
    public function write($p_templateFileName = null)
    {
        // sets the output file to write to
        if (!is_null($p_templateFileName)) {
            $output = $this->m_templatePathDirectory . '/' . $p_templateFileName;
        } else {
            $output = $this->m_templatePathDirectory . '/' . $this->m_templateFileName;
        }
        if (file_exists($output) && !is_writable($output) || !is_writable($this->m_templatePathDirectory)) {
            return new PEAR_Error('Could not write template file');
        }
        if (@file_put_contents($output, $this->m_templateContent) == false) {
            return new PEAR_Error('Could not write template file');
        }
        return true;
    }