private static function contextValueToString($val)
    {

        if (is_bool($val)) {
            return var_export($val, true);

        } elseif (is_scalar($val)) {
            return (string)$val;

        } elseif (is_null($val)) {
            return 'NULL';

        } elseif (is_object($val)) {
            if (is_callable(array($val, '__toString'))) {
                return (string)$val;
            }
            return get_class($val);
        }
        return gettype($val);
    }
private static function contextValueToString($val)
    {

        if (is_bool($val)) {
            return var_export($val, true);

        } elseif (is_scalar($val)) {
            return (string)$val;

        } elseif (is_null($val)) {
            return 'NULL';

        } elseif (is_object($val)) {
            if (is_callable(array($val, '__toString'))) {
                return (string)$val;
            }
            return get_class($val);
        }
        return gettype($val);
    }
private static function contextValueToString ( $ val ) { if ( is_bool ( $ val ) ) { return var_export ( $ val , true ) ; } elseif ( is_scalar ( $ val ) ) { return ( string ) $ val ; } elseif ( is_null ( $ val ) ) { return 'NULL' ; } elseif ( is_object ( $ val ) ) { if ( is_callable ( array ( $ val , '__toString' ) ) ) { return ( string ) $ val ; } return get_class ( $ val ) ; } return gettype ( $ val ) ; }
Converts a context value into its appropriate string representation

@param mixed $val
@return string
Converts a context value into its appropriate string representation