Piwik\DataTable\Renderer\Csv::formatValue PHP Метод

formatValue() защищенный Метод

Formats/Escapes the given value
protected formatValue ( mixed $value ) : string
$value mixed
Результат string
    protected function formatValue($value)
    {
        if (is_string($value) && !is_numeric($value)) {
            $value = html_entity_decode($value, ENT_COMPAT, 'UTF-8');
        } elseif ($value === false) {
            $value = 0;
        }
        $value = $this->formatFormulas($value);
        if (is_string($value) && (strpos($value, '"') !== false || strpos($value, $this->separator) !== false)) {
            $value = '"' . str_replace('"', '""', $value) . '"';
        }
        // in some number formats (e.g. German), the decimal separator is a comma
        // we need to catch and replace this
        if (is_numeric($value)) {
            $value = (string) $value;
            $value = str_replace(',', '.', $value);
        }
        return $value;
    }