/*! convert array to string representation ( it is a bit more readable than var_dump )

@param data
data object
@param pref
prefix string, used for formating, optional
@return
string with array description
350474
private static function log_details($data,$pref=""){
		if (is_array($data)){
			$str=array("");
			foreach($data as $k=>$v)
				array_push($str,$pref.$k." => ".LogMaster::log_details($v,$pref."\t"));
			return implode("\n",$str);
   		}
   		return $data;
	}
1352038
public static String toBinaryString(final byte[] data) {
        if (data == null) {
            return null;
        }
        final StringBuilder buf = new StringBuilder(data.length * 8);
        for (final byte element : data) {
            byte bits = element;
            for (int j = 0; j < 8; j++) {
                if ((bits & 0x80) == 0x80) {
                    buf.append('1');
                } else {
                    buf.append('0');
                }
                bits <<= 1;
            }
        }
        return buf.toString();
    }
216404
public static String stringLiteral(String data) {
    StringBuilder result = new StringBuilder();
    result.append('"');
    for (int i = 0; i < data.length(); i++) {
      char c = data.charAt(i);
      switch (c) {
        case '"':
          result.append("\\\"");
          break;
        case '\\':
          result.append("\\\\");
          break;
        case '\t':
          result.append("\\\t");
          break;
        case '\b':
          result.append("\\\b");
          break;
        case '\n':
          result.append("\\\n");
          break;
        case '\r':
          result.append("\\\r");
          break;
        case '\f':
          result.append("\\\f");
          break;
        default:
          result.append(c);
      }
    }
    result.append('"');
    return result.toString();
  }
713067
function arrayBufferToDataURL(arrayBuffer, mimeType) {
  var uint8 = new Uint8Array(arrayBuffer);
  var data = '';

  // TypedArray.prototype.forEach is not supported in some browsers.
  forEach(uint8, function (value) {
    data += fromCharCode(value);
  });

  return 'data:' + mimeType + ';base64,' + btoa(data);
}
114247
function getPresetsString(presetArray) {
  if (!presetArray.includes("react-app")) {
    presetArray.push("react-app");
  }
  return presetArray.map(attachRequestResolve("preset")).join(",");
}
737159
function __serializeArrayBuffer(data) {
	let length = data.byteLength;
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, data];
}
874253
function __serializeString(data) {
	let dataBuffer = UTF8Encode(data);
	let length = dataBuffer.byteLength;
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, dataBuffer];
}
813594
private function encodeString($data = null)
    {
        $data = is_null($data) ? $this->data : $data;
        return sprintf("%d:%s", strlen($data), $data);
    }
530598
function stringify(data){
		switch(typeof data){
			case 'string':
				return '"'+ data.replace(reg_rep, function(a){
					return rep[a];
				}) +'"';
			
			case 'object':
				if(data===null){return 'null'}
				var res = [], k, v;
				if(data instanceof Array){
					var l = data.length;
					for(k = 0; k < l; k++){
						v = stringify(data[k]);
						v===undef || res.push(v);
					}
					return '['+ res.join(',') +']';
				}else{
					for(k in data){
						if(data.hasOwnProperty(k) && k){
							v = stringify(data[k]);
							(jskw[k] || reg_d.test(k)) && (k = '"'+k+'"');
							v===undef || res.push(k +':'+ v);
						}
					}
					return '{'+ res.join(',') +'}';
				}

			case 'number':
				return isFinite(data) ? data.toString() : 'null';
			
			case 'undefined':
			case 'unknown':
				return;
			case 'function':
			case 'boolean':
			case 'regexp':
				return data.toString();
		}
	}
1217559
function stringify (data) {
  var str;
  if (typeof data !== OBJECT) { return data; }
  str = data.x + ' ' + data.y;
  if (data.z != null) { str += ' ' + data.z; }
  if (data.w != null) { str += ' ' + data.w; }
  return str;
}
312210
protected function _arrayToString($data)
    {
        $fields = array();
        foreach($data as $value)
        {
            //Implode array's
            if(is_array($value)) {
                $value = implode(',', $value);
            }

             // Escape the quote character within the field (e.g. " becomes "")
            if ($this->_quoteValue($value))
            {
                $quoted_value = str_replace($this->quote, $this->quote.$this->quote, $value);
                $fields[] 	  = $this->quote . $quoted_value . $this->quote;
            }
            else $fields[] = $value;
        }

        return  implode($this->separator, $fields);
    }
869073
private function stringLineMaker($array, $prepend = '')
    {
        $output = '';

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $value = $this->stringLineMaker($value, $prepend.'    ');

                $output .= "\n{$prepend}    '{$key}' => [{$value}\n{$prepend}    ],";
            } else {
                $value = str_replace('\"', '"', addslashes($value));

                $output .= "\n{$prepend}    '{$key}' => '{$value}',";
            }
        }

        return $output;
    }
293238
public static StringBuffer encode(byte[] data)
	{
		int rem = data.length % 3;
		int num = data.length / 3;
		StringBuffer result = new StringBuffer();
		int p = 0;
		// int c=0;

		for (int i = 0; i < num; i++)
		{
			int b1 = (data[p] & 0xfc) >> 2;
			int b2 = (data[p] & 0x03) << 4 | (data[p + 1] & 0xf0) >> 4;
			int b3 = (data[p + 1] & 0x0f) << 2 | (data[p + 2] & 0xc0) >> 6;
			int b4 = data[p + 2] & 0x3f;

			result.append(b64encode(b1));
			result.append(b64encode(b2));
			result.append(b64encode(b3));
			result.append(b64encode(b4));

			p += 3;
			// c += 4;
		}

		switch (rem)
		{
			case 0:
				break;

			case 1:
			{
				int b1 = (data[p] & 0xfc) >> 2;
				int b2 = (data[p] & 0x03) << 4;

				result.append(b64encode(b1));
				result.append(b64encode(b2));
				result.append('=');
				result.append('=');
				break;
			}

			case 2:
			{
				int b1 = (data[p] & 0xfc) >> 2;
				int b2 = (data[p] & 0x03) << 4 | (data[p + 1] & 0xf0) >> 4;
				int b3 = (data[p + 1] & 0x0f) << 2;

				result.append(b64encode(b1));
				result.append(b64encode(b2));
				result.append(b64encode(b3));
				result.append('=');
				break;
			}
		}

		return result;
	}
566533
protected function _serialize($data)
	{
		if (is_array($data))
		{
			foreach ($data as $key => $val)
			{
				if (is_string($val))
				{
					$data[$key] = str_replace('\\', '{{slash}}', $val);
				}
			}
		}
		else
		{
			if (is_string($data))
			{
				$data = str_replace('\\', '{{slash}}', $data);
			}
		}

		return serialize($data);
	}
582948
protected function _toString($data) {
		foreach ($data as $key => $val) {
			switch (true) {
				case is_object($val) && !$val instanceof \Closure:
					try {
						$data[$key] = (string) $val;
					} catch (Exception $e) {
						$data[$key] = '';
					}
				break;
				case is_array($val):
					$data = array_merge($data, Set::flatten($val));
				break;
			}
		}
		return $data;
	}
1069504
function(_data,_prefix){
        if (_data==null){
            return 'null:null';
        }
        if (_u._$isBoolean(_data)){
            return 'boolean:'+!!_data;
        }
        if (_u._$isNumber(_data)){
            return 'number:'+_data;
        }
        if (_u._$isString(_data)){
            return 'string:'+encodeURIComponent(_data);
        }
        if (_u._$isDate(_data)){
            return 'Date:'+_data.getTime();
        }
        if (_u._$isArray(_data)){
            return __doSerializeArray(_data,_prefix);
        }
        if (_u._$isObject(_data)){
            return __doSerializeObject(_data,_prefix);
        }
        if (_u._$isFunction(_data,'function')){
            return '';
        }
        return 'default:'+_data;
    }
1147725
function _gpfArrayFromString(array, string) {
        var length = string.length, index = 0;
        for (; index < length; ++index) {
            array.push(string.charAt(index));
        }
    }