LightnCandy\Encoder::raw PHP Method

raw() public static method

Get string value
public static raw ( array\arraystring | integer> $cx, arraystring | integer> | integer | null $v ) : string
$cx array\arraystring | integer>
$v arraystring | integer> | integer | null
return string The raw value of the specified variable
    public static function raw($cx, $v)
    {
        if ($v === true) {
            if ($cx['flags']['jstrue']) {
                return 'true';
            }
        }
        if ($v === false) {
            if ($cx['flags']['jstrue']) {
                return 'false';
            }
        }
        if (is_array($v)) {
            if ($cx['flags']['jsobj']) {
                if (count(array_diff_key($v, array_keys(array_keys($v)))) > 0) {
                    return '[object Object]';
                } else {
                    $ret = array();
                    foreach ($v as $k => $vv) {
                        $ret[] = static::raw($cx, $vv);
                    }
                    return join(',', $ret);
                }
            } else {
                return 'Array';
            }
        }
        return "{$v}";
    }