Returns a string with the type of $data in lower case.
Unlike php's gettype, this method will:
- Return "closure" for anonymous functions (instead of "object")
- Return "float", instead of "double"

@param mixed $data
@return string
336493
public static function typeof($data) {
        if ($data instanceof \Closure) return "closure";

        $type = strtolower(gettype($data));
        if ($type === "double") return "float";
        return $type;
    }
526025
public static function determine($data) : int
    {
        switch (gettype($data)) {
            case 'string':
                return self::CATEGORICAL;

            case 'double':
                return self::CONTINUOUS;

            case 'integer':
                return self::CONTINUOUS;

            case 'resource':
                return self::RESOURCE;

            default:
                return self::OTHER;
        }
    }
1181187
public function decode($data)
    {
        $data = (string) $data;
        // skip empty strings (that cause "Syntax error"?)
        if ($data === '') {
            return null;
        }

        $data = json_decode($data, $this->options['assoc'], $this->options['depth'],
            $this->options['flags']);
        if (json_last_error() > 0) {
            $data = null;
            $this->error = json_last_error_msg() ?: 'Unknown';
        }

        return $data;
    }
723304
private function extractScriptDataValue_String(&$data)
    {
        $stringLength = $this->parseUI16(substr($data, 0, 2));
        $result = substr($data, 2, $stringLength);
        $data = substr($data, 2 + $stringLength);

        return $result;
    }
416124
public function encode(string $data): string
    {
        $data = str_split($data);
        $data = array_map("ord", $data);

        $leadingZeroes = 0;
        while (!empty($data) && 0 === $data[0]) {
            $leadingZeroes++;
            array_shift($data);
        }
        $converted = $this->baseConvert($data, 256, 62);
        if (0 < $leadingZeroes) {
            $converted = array_merge(
                array_fill(0, $leadingZeroes, 0),
                $converted
            );
        }
        return implode("", array_map(function ($index) {
            return $this->options["characters"][$index];
        }, $converted));
    }
583146
private function normalizeFloat($data) {
		if (is_infinite($data)) {
			$postfix = 'INF';
			if ($data < 0) {
				$postfix = '-' . $postfix;
			}
			$data = $postfix;
		} else {
			if (is_nan($data)) {
				$data = 'NaN';
			}
		}

		return $data;
	}
761644
private function extractScriptDataValue_Double(&$data)
    {
        $result = $this->parseDouble(substr($data, 0, 8));
        $data = substr($data, 8);

        return $result;
    }
1309069
private static function initType($data)
    {
        if (!is_string($data)) {
            return false;
        }

        $data = trim($data);
        switch (true) {
            case (in_array($data, ['true', 'false'], false)):
                return (bool)(strpos($data, 'true') !== false) ? true : false;
            case !is_numeric($data):
                if ($res = json_decode($data)) {
                    return $res;
                } else if (preg_match(self::PATTERN_SERIALIZE, $data) &&  ($res = @unserialize($data)) !== false) {
                    return $res;
                } else if ((preg_match(self::PATTERN_STRIP_QUOTES, $data, $match)) === 1) {
                    return (string) $match[1];
                } else {
                    return (string)$data;
                }
        }

        if (is_numeric($data) && strpos($data, '.') === false) {
            return (int)$data;
        } else {
            return (float)$data;
        }
    }
526782
public function unserialize($data)
    {
        $this->throwIfTrue(!is_string($data), '$data must be a string');

        set_error_handler($this->getErrorHandler());
        try {
            $unserialized = unserialize($data);
            $this->throwIfTrue($unserialized === false, '$data could not be unserialized');
            return $unserialized;
        } finally {
            restore_error_handler();
        }
    }
355389
public function convert($data)
    {
        if (empty($data) || ($out = @serialize($data)) === false)
            return null;

        return $out;
    }
768184
protected static function dataToString($data)
    {
        if (!is_string($data))
        {
            try
            {
                $data = \GuzzleHttp\json_encode($data);
            }
            catch (\InvalidArgumentException $e)
            {

            }
        }

        return $data;
    }
492896
function(_data,_type){
        try{
            _type = _type.toLowerCase();
            if (_data===null) return _type=='null';
            if (_data===undefined) return _type=='undefined';
            return _o.toString.call(_data).toLowerCase()=='[object '+_type+']';
        }catch(e){
            return !1;
        }
    }
492411
protected function unPrepareData($data){
        $dataUn = @unserialize($data);
        if ($data === 'b:0;' || $dataUn !== false) {
            return $dataUn;
        } else {
            echo $data;
        }
    }
1093700
protected function convert($data)
    {
        if ($data instanceof DateTime) {
            $data = clone $data; // don't change to original value
            return $data->setTimezone($this->timezone)->format('Y-m-d\TG:i:s\Z');
        }

        if (is_object($data) && !method_exists($data, '__toString')) {
            return null; // can't convert object to a string.
        }

        if (is_array($data)) {
            return null; // can't convert a array to a string.
        }

        if (is_bool($data)) {
            return $data ? '1' : '0'; // would otherwise be empty if converted to a string
        }

        return $data !== null ? (string)$data : null;
    }
650750
static public function toObject($data)
    {
        if (is_object($data)) {
            return $data;
        }
        if (is_array($data)) {
            $data = json_encode($data);
        }
        return json_decode($json);
    }
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;
	}
416747
private function getstring($data = "")
    {
        $char = fread($this->fp, 1);
        while (ord($char) > 0) {        // 字符串按照C格式保存，以\0结束
            $data .= $char;             // 将读取的字符连接到给定字符串之后
            $char = fread($this->fp, 1);
        }
        
        return $data;
    }