Sepia\PoParser::cleanExport PHP Method

cleanExport() protected method

Prepares a string to be outputed into a file.
protected cleanExport ( string $string ) : string
$string string The string to be converted.
return string
    protected function cleanExport($string)
    {
        $quote = '"';
        $slash = '\\';
        $newline = "\n";
        $replaces = array("{$slash}" => "{$slash}{$slash}", "{$quote}" => "{$slash}{$quote}", "\t" => '\\t');
        $string = str_replace(array_keys($replaces), array_values($replaces), $string);
        $po = $quote . implode("{$slash}n{$quote}{$newline}{$quote}", explode($newline, $string)) . $quote;
        // remove empty strings
        return str_replace("{$newline}{$quote}{$quote}", '', $po);
    }