Decode data

@param   string  $data
@return  mixed
344705
static public function decode($data)
	{
	    return json_decode($data, true) ? : ($data && $data!='\"\"' && $data !='false' ? $data : null);
	}
178140
private function decode($data)
	{
		return function_exists('json_decode') ? json_decode($data, true) : CJSON::decode($data, true);
	}
829066
protected function _decodeData(array $data)
    {
        $result = [];

        if (\is_array($data[0])) {
            foreach ($data[0] as $k => $v) {
                $result[$k] = $this->_decodeData([
                    $data[0][$k], $data[1][$k], $data[2][$k], $data[3][$k], $data[4][$k]
                ]);
            }

            return $result;
        }

        return [
            'name' => $data[0],
            'type' => $data[1],
            'tmp_name' => $data[2],
            'error' => $data[3],
            'size' => $data[4]
        ];
    }
315694
public static function json_decode($data)
    {
        $data_json = @json_decode($data, true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \Exception(
                sprintf('An error occurred while trying to decode JSON data [code "%s"]!', json_last_error())
            );
        } else {
            $data = $data_json;
        }
        return $data;
    }
278648
public function decode($data)
    {
        $result = [];
        $offset = 0;
        $length = strlen($data);
        while ($offset < $length)
        {
            if (!strstr(substr($data, $offset), '|'))
            {
                return [];
            }
            $pos = strpos($data, '|', $offset);
            $num = $pos - $offset;
            $varname = substr($data, $offset, $num);
            $offset += $num + 1;
            $dataItem = unserialize(substr($data, $offset));
            $result[$varname] = $dataItem;
            $offset += strlen(serialize($dataItem));
        }
        return $result;
    }
166953
public function decode($data): array
    {
        $result = RequestContext::getServerBean($this->formatHandlerClass)->decode($data);
        if(!is_array($result))
        {
            $result = [];
        }
        return $result;
    }
172865
private function decrypt($data)
	{
		$key = md5($this->_config['serverSecret']);
	    $x = 0;
	    $data = base64_decode($data);
	    $len = strlen($data);
	    $l = strlen($key);
	    for ($i = 0; $i < $len; $i++)
	    {
	        if ($x == $l) 
	        {
	            $x = 0;
	        }
	        $char .= substr($key, $x, 1);
	        $x++;
	    }
	    for ($i = 0; $i < $len; $i++)
	    {
	        if (ord(substr($data, $i, 1)) < ord(substr($char, $i, 1)))
	        {
	            $str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1)));
	        }
	        else
	        {
	            $str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1)));
	        }
	    }
	    return $str;
	}
160374
public function encode($data)
    {
        if ($data !== null) {
            $data = gzencode((string) $data, $this->options['level'], $this->options['mode']);
            if ($data === false) {
                $data = null;
                $this->error = error_get_last()['message'] ?? 'Unknown';
            }
        }

        return $data;
    }
1153369
private function deserialize($data)
    {
        $result = json_decode(base64_decode($data, true), true);

        return is_array($result) ? $result : [];
    }
578741
protected function _unserialize($data)
	{
		$data = @unserialize(stripslashes($data));

		if (is_array($data))
		{
			foreach ($data as $key => $val)
			{
				if (is_string($val))
				{
					$data[$key] = str_replace('{{slash}}', '\\', $val);
				}
			}

			return $data;
		}

		return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data;
	}
211208
public function decode($data): array
    {
        $headerVar = $this->getHeaderField();
        $bodyVar = $this->getBodyField();
        $rawVar = $this->getRawField();

        // Define empty content
        $content = [
            $headerVar => [],
            $bodyVar => ''
        ];

        $headerRegex = "/^---\n(.+?)\n---\n{0,}(.*)$/uis";

        // Normalize line endings to Unix style.
        $data = preg_replace("/(\r\n|\r)/", "\n", $data);

        // Parse header.
        preg_match($headerRegex, ltrim($data), $matches);
        if(empty($matches)) {
            $content[$bodyVar] = $data;
        } else {
            // Normalize frontmatter.
            $frontmatter = preg_replace("/\n\t/", "\n    ", $matches[1]);
            if ($rawVar) {
                $content[$rawVar] = $frontmatter;
            }
            $content[$headerVar] = $this->getHeaderFormatter()->decode($frontmatter);
            $content[$bodyVar] = $matches[2];
        }

        return $content;
    }
397719
public function decode(string $data)
    {
        if (serialize(false) == $data) {
            return false;
        } elseif (false !== ($ret = @unserialize($data))) {
            return $ret;
        } else {
            throw new DecodeException('unserialize() error');
        }
    }
1087833
public function encode($data)
    {
        // skip empty strings
        if ($data === '') {
            return '""';
        }

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

        return $data;
    }
612397
public function decode($data)
    {
        if ($data !== null) {
            $data = gzdecode((string) $data, $this->options['length']);
            if ($data === false) {
                $data = null;
                $this->error = error_get_last()['message'] ?? 'Unknown';
            }
        }

        return $data;
    }
859833
public function decode($data)
    {
        $add = $convert = array();

        if (is_array($data)) {
            $params = $data;
        } else {
            $parts = explode(';', $data, 2);
            if (isset($parts[0]) && (strpos($parts[0], '=') === false)) {
                $this->setContentParamValue($parts[0]);
                $param = isset($parts[1]) ? $parts[1] : null;
            } else {
                $param = $data;
            }

            if (empty($param)) {
                $params = array();
            } else {
                $decode = new Horde_Mime_ContentParam_Decode();
                $params = $decode->decode($param);
            }
        }

        $to_add = array();

        foreach ($params as $name => $val) {
            /* Asterisk at end indicates encoded value. */
            if (substr($name, -1) == '*') {
                $name = substr($name, 0, -1);
                $encoded = true;
            } else {
                $encoded = false;
            }

            /* This asterisk indicates continuation parameter. */
            if ((($pos = strrpos($name, '*')) !== false) &&
                is_numeric($order = substr($name, $pos + 1))) {
                $name = substr($name, 0, $pos);
                $to_add[Horde_String::lower($name)][$order] = $val;
            } else {
                $to_add[$name] = array($val);
            }

            if ($encoded) {
                $convert[$name] = true;
            }
        }

        foreach ($to_add as $key => $val) {
            ksort($val);
            $add[$key] = implode('', $val);
        }

        foreach (array_keys($convert) as $name) {
            $val = $add[$name];
            $quote = strpos($val, "'");

            if ($quote === false) {
                $add[$name] = urldecode($val);
            } else {
                $orig_charset = substr($val, 0, $quote);
                if (Horde_String::lower($orig_charset) == 'iso-8859-1') {
                    $orig_charset = 'windows-1252';
                }

                /* Ignore language. */
                $quote = strpos($val, "'", $quote + 1);
                substr($val, $quote + 1);
                $add[$name] = Horde_String::convertCharset(
                    urldecode(substr($val, $quote + 1)),
                    $orig_charset,
                    'UTF-8'
                );
            }
        }

        /* MIME parameters are supposed to be encoded via RFC 2231, but many
         * mailers do RFC 2045 encoding instead. However, if we see at least
         * one RFC 2231 encoding, then assume the sending mailer knew what
         * it was doing and didn't send any parameters RFC 2045 encoded. */
        if (empty($convert)) {
            foreach ($add as $key => $val) {
                $add[$key] = Horde_Mime::decode($val);
            }
        }

        if (count($add)) {
            foreach ($add as $key => $val) {
                /* When parsing a content-param string, lowercase all
                 * parameter names to normalize. Only maintain case of
                 * parameters explicitly added by calling code. */
                $this[Horde_String::lower($key)] = $val;
            }
        } elseif (is_string($data)) {
            $this->setContentParamValue($parts[0]);
        }
    }
667757
public function deserialize($data)
    {
        $result = json_decode($data, true);
        if ($result === null) {
            return $data;
        }
        return $result;
    }
559589
public static function encodeData($data)
    {
        if (\is_array($data)) {
            foreach ($data as $key => $value) {
                $data[$key] = \urlencode($value);
            }

            return $data;
        }

        return \urlencode($data);
    }