Parse the raw data into the packet
@param $data String the raw data to parse (minus packet ID and packet length
330407
public function fromRawData($data)
    {
        $secretLength = VarInt::readUnsignedVarInt($data);
        $data = substr($data, $secretLength->getDataLength());

        $secretData = substr($data, 0, $secretLength->getValue());
        $data = substr($data, $secretLength->getValue());

        $verifyLength = VarInt::readUnsignedVarInt($data);
        $data = substr($data, $verifyLength->getDataLength());

        $verifyData = substr($data, 0, $verifyLength->getValue());

        $this->setToken($verifyData)->setSecret($secretData);
    }
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');
        }
    }
1353782
private function parseUI16($data)
    {
        if (!isset($data[1])) {
            throw new UnexpectedValueException();
        }
        $unpacked = unpack('n', $data);

        return array_shift($unpacked);
    }
441917
protected function prepareData($data)
    {

        $format  = "The following attack has been detected by PHPIDS\n\n";
        $format .= "IP: %s \n";
        $format .= "Date: %s \n";
        $format .= "Impact: %d \n";
        $format .= "Affected tags: %s \n";

        $attackedParameters = '';
        foreach ($data as $event) {
            $attackedParameters .= $event->getName() . '=' .
                ((!isset($this->urlencode) ||$this->urlencode) 
                    ? urlencode($event->getValue()) 
                    : $event->getValue()) . ", ";
        }

        $format .= "Affected parameters: %s \n";
        $format .= "Request URI: %s \n";
        $format .= "Origin: %s \n";

        return sprintf($format,
                       $this->ip,
                       date('c'),
                       $data->getImpact(),
                       join(' ', $data->getTags()),
                       trim($attackedParameters),
                       htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'),
                       $_SERVER['SERVER_ADDR']);
    }
977828
private static function decode($data) {
		if((is_array($data) && isset($data[0])) || (isset($data[0]) && !is_string($data[0]))) {
			return self::parseArray($data);
		} else if (is_null($data) || is_scalar($data)) {
			return $data;
		} else {
			return self::decodeNewObject($data);
		}
	}
916325
public function load($data)
    {
        // Turn current string into an array using provided separator
        $values = explode(',', $data);

        // If empty string is passed, then explode() returns false
        if ($values === false) {
            $values = array();
        } else {
            // Remove empty values from current array we have
            array_walk($values, function($value, $key) use (&$values) {
                if (empty($value)) {
                    unset($values[$key]);
                }
            });
        }

        // Done
        $this->values = $values;
    }
759166
public static function decode($data)
    {
        $rData = strtr($data, '-_', '+/');
        $rMod4 = strlen($rData) % 4;
        if ($rMod4) {
            $rData .= substr('====', $rMod4);
        }
        return base64_decode($rData);
    }
1267047
protected function parseDistinct($data)
    {
        $set = $this->_parseDataItemToKeys($data, $this->query->hasAlias());
        return empty($set) ? '' : 'DISTINCT ' . implode(',', array_unique($set));
    }
861776
private function unpackData($data)
    {
        $arr = unserialize($data);

        if (time() > $arr['expires'] && $arr['expires'] !== 0) {
            return false;
        }

        return $arr['data'];
    }
174188
public function parseMulitpartData($data)
    {
        $multipartData = [];
        foreach($data as $name => $contents) {
            $name = strtolower($name);
            if ($name !== 'file') {
                $multipartData[] = [
                    'name' => $name,
                    'contents' => $contents
                ];
            }
        }
        return $multipartData;
    }
299822
public function canParse($data)
	{
		$data = trim($data);

		try
		{
			// Parse config string
			$parsed = SymfonyYaml::parse($data, true);
		}
		catch (Exception $e)
		{
			return false;
		}

		return true;
	}
50817
private function parseSockData($data)
    {
        $return = [];

        $lines = (array) explode("\n", trim($data));

        foreach ($lines as $line) {
            if (preg_match('/(\w+)\s*:\s*([-+]?[\d\.]+)/i', $line, $match) == 1) {
                $return[] = array(
                    'path' => 'N/A',
                    'name' => $match[1],
                    'temp' => $match[2],
                    'unit' => '', // TODO
                );
            }
        }

        return $return;
    }
698378
protected function extractAndSetData($data)
    {
        // Attempt to load as Json first, as it's easier to recognise a failure on
        $data_parsed = json_decode($data, true);

        // If there's an error, maybe it's array data? We do this second because parse_str is super-uncaring.
        if (json_last_error() !== JSON_ERROR_NONE) {
            parse_str($data, $data_parsed);
        }

        if (is_array($data_parsed)) {
            $this->setAll($data_parsed);
        }
    }
404367
public function parse($data)
    {
        if (!empty($data)) {
            //$data = eregi_replace(">"."[[:space:]]+"."< ",">< ",$data);
            $data = preg_replace("/>\s+</i", '><', $data);
            if (!xml_parse($this->parser, $data, true)) {
                $this->xmlParsingError = '';
                $this->xmlParsingError = xml_error_string(xml_get_error_code($this->parser));
                $this->xmlParsingError .= xml_get_current_line_number($this->parser);

                return false;
            //+++ die($reason);
            } else {
                return true;
            }
        } else {
            $this->xmlParsingError = 'No data to parse!';

            return false;
        }
    }
1336973
public function data($data=''){
        if('' === $data && !empty($this->data)) {
            return $this->data;
        }
        if(is_object($data)){
            $data   =   get_object_vars($data);
        }elseif(is_string($data)){
            parse_str($data,$data);
        }elseif(!is_array($data)){
            E(L('_DATA_TYPE_INVALID_'));
        }
        $this->data = $data;
        return $this;
    }
648376
public function setPayload($data)
    {
        if (!is_string($data)) {
            if (is_array($data)) {
                $data = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            } else {
                $data = serialize($data);
            }
        }

        $maxLength = 255;
        if (mb_strlen($data) > $maxLength) {
            // Truncate too long payload
            $data = mb_substr($data, 0, $maxLength - 3) . '...';
        }

        $this->payload = $data ? $data : null;

        return $this;
    }
242550
protected function parseData(array $data)
	{
		$this->files = array();

		foreach ($data as $key => $value)
		{
			// If this value is an instance of the HttpFoundation File class we will
			// remove it from the data array and add it to the files array, which
			// is used to conveniently separate out the files from other datas.
			if ($value instanceof File)
			{
				$this->files[$key] = $value;

				unset($data[$key]);
			}
		}

		return $data;
	}