BaseQuery::quote PHP Method

quote() protected method

protected quote ( $value ) : string
$value
return string
    protected function quote($value)
    {
        if (!isset($value)) {
            return "NULL";
        }
        if (is_array($value)) {
            // (a, b) IN ((1, 2), (3, 4))
            return "(" . implode(", ", array_map(array($this, 'quote'), $value)) . ")";
        }
        $value = $this->formatValue($value);
        if (is_float($value)) {
            return sprintf("%F", $value);
            // otherwise depends on setlocale()
        }
        if ($value === false) {
            return "0";
        }
        if (is_int($value) || $value instanceof FluentLiteral) {
            // number or SQL code - for example "NOW()"
            return (string) $value;
        }
        return $this->fpdo->getPdo()->quote($value);
    }