public function escape($value, $context = 'html')
    {
        if (is_numeric($value)) {
            return $value;
        }

        // If we deal with a scalar value, we can cache the result to increase
        // the performance when the same value is escaped multiple times (e.g. loops)
        if (is_scalar($value)) {
            if (!isset(self::$escaperCache[$context][$value])) {
                self::$escaperCache[$context][$value] = $this->getEscaper($context)($value);
            }

            return self::$escaperCache[$context][$value];
        }

        return $this->getEscaper($context)($value);
    }
public function escape($value, $context = 'html')
    {
        if (is_numeric($value)) {
            return $value;
        }

        // If we deal with a scalar value, we can cache the result to increase
        // the performance when the same value is escaped multiple times (e.g. loops)
        if (is_scalar($value)) {
            if (!isset(self::$escaperCache[$context][$value])) {
                self::$escaperCache[$context][$value] = $this->getEscaper($context)($value);
            }

            return self::$escaperCache[$context][$value];
        }

        return $this->getEscaper($context)($value);
    }
public function escape ( $ value , $ context = 'html' ) { if ( is_numeric ( $ value ) ) { return $ value ; } // If we deal with a scalar value, we can cache the result to increase // the performance when the same value is escaped multiple times (e.g. loops) if ( is_scalar ( $ value ) ) { if ( ! isset ( self :: $ escaperCache [ $ context ] [ $ value ] ) ) { self :: $ escaperCache [ $ context ] [ $ value ] = $ this -> getEscaper ( $ context ) ( $ value ) ; } return self :: $ escaperCache [ $ context ] [ $ value ] ; } return $ this -> getEscaper ( $ context ) ( $ value ) ; }
Escapes a string by using the current charset.

@param mixed  $value   A variable to escape
@param string $context The context name

@return string The escaped value
Escapes a string by using the current charset .