public function singleQuote($value, bool $maybe_use_sld = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->singleQuote($_value);
            } // unset($_key, $_value);
            return $value;
        }
        $string = (string) $value;

        if ($maybe_use_sld) {
            if (!isset($string[0])) {
                return "''"; // Empty string.
            } elseif ($string === "''" || $string === '""') {
                return "''"; // Empty string.
            } elseif (mb_strpos($string, "'") === 0 && mb_substr($string, -1) === "'") {
                return "'".str_replace("'", "\\'", mb_substr($string, 1, -1))."'";
            } elseif (mb_strpos($string, '"') === 0 && mb_substr($string, -1) === '"') {
                return "'".str_replace("'", "\\'", mb_substr($string, 1, -1))."'";
            } else {
                return "'".str_replace("'", "\\'", $string)."'"; // Defaul behavior.
            }
        } else {
            return "'".str_replace("'", "\\'", $string)."'"; // Defaul behavior.
        }
    }