src/PoEntry.php
protected function formatQuotedString($value, bool $bare = false): string
    {
        if (is_array($value)) {
            $string = '';
            foreach ($value as $partial) {
                $string .= $this->formatQuotedString($partial, true) . "\n";
            }
            return $bare ? $string : ' ' . $string;
        } else {
            $string = ($value === null) ? '' : $value;
            $string = stripcslashes($string);
            $string = addcslashes($string, "\0..\37\"");
            $string = '"' . $string . '"';
            return $bare ? $string : ' ' . $string . "\n";
        }
    }
protected function formatQuotedString($value, bool $bare = false): string
    {
        if (is_array($value)) {
            $string = '';
            foreach ($value as $partial) {
                $string .= $this->formatQuotedString($partial, true) . "\n";
            }
            return $bare ? $string : ' ' . $string;
        } else {
            $string = ($value === null) ? '' : $value;
            $string = stripcslashes($string);
            $string = addcslashes($string, "\0..\37\"");
            $string = '"' . $string . '"';
            return $bare ? $string : ' ' . $string . "\n";
        }
    }
protected function formatQuotedString ( $ value , bool $ bare = false ) : string { if ( is_array ( $ value ) ) { $ string = '' ; foreach ( $ value as $ partial ) { $ string .= $ this -> formatQuotedString ( $ partial , true ) . "\n" ; } return $ bare ? $ string : ' ' . $ string ; } else { $ string = ( $ value === null ) ? '' : $ value ; $ string = stripcslashes ( $ string ) ; $ string = addcslashes ( $ string , "\0..\37\"" ) ; $ string = '"' . $ string . '"' ; return $ bare ? $ string : ' ' . $ string . "\n" ; } }
format a string for output by escaping control and double quote
characters, then surrounding with double quotes

@param string|string[]|null $value string to prepare
@param boolean              $bare  true for bare output, default false adds leading
space and trailing newline

@return string
format a string for output by escaping control and double quote characters then surrounding with double quotes