Remove the @ prefix from keys that denotes an attribute in XML. This
cannot be represented in JSON, so it's effectively ignored.

@param array $data
The array to strip @ from the keys.
@return array
431725
protected function stripAttributeMarker(array $data)
    {
        foreach ($data as $key => $value) {
            if (substr($key, 0, 5) == '@xml:') {
                $data[substr($key, 5)] = $value;
                unset ($data[$key]);
            } elseif (substr($key, 0, 1) == '@') {
                $data[substr($key, 1)] = $value;
                unset ($data[$key]);
            }

            if (is_array($value)) {
                $data[$key] = $this->stripAttributeMarker($value);
            }
        }

        return $data;
    }
104478
protected function cleanFormData(array $data)
    {
        foreach ($data as $key => $value) {
            if (\is_array($value)) {
                $data[$key] = $this->cleanFormData($value);
            } elseif (\is_object($value)) {
                unset($data[$key]);
            }
        }

        return $data;
    }
884369
public static function deserializeObject(array $data)
    {
        $subAttributes = [];
        if (isset($data['subAttributes'])) {
            foreach ($data['subAttributes'] as $subAttribute) {
                $subAttributes[] = static::deserializeObject($subAttribute);
            }
        }
        $result = new static(
            $data['name'],
            $data['type'],
            $data['multiValued'],
            $data['required'],
            isset($data['description']) ? $data['description'] : null,
            $subAttributes,
            isset($data['canonicalValues']) ? $data['canonicalValues'] : [],
            isset($data['caseExact']) ? $data['caseExact'] : false,
            $data['mutability'],
            $data['returned'],
            isset($data['uniqueness']) ? $data['uniqueness'] : null,
            isset($data['referenceTypes']) ? $data['referenceTypes'] : []
        );

        return $result;
    }
1357166
private function decodeNonUtf8FromUtf8(array $data)
    {
        $encodedKeys = [];
        if (isset($data[$this->encodingAnnotation])) {
            $encodedKeys = $data[$this->encodingAnnotation];
            unset($data[$this->encodingAnnotation]);
        }

        $decodedData = [];
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $value = $this->decodeNonUtf8FromUtf8($value);
            }

            if (isset($encodedKeys[$key])) {
                $originalKey = $key;
                if ($encodedKeys[$key] & static::KEY_UTF8ENCODED) {
                    $key = mb_convert_encoding($key, '8bit', 'UTF-8');
                }
                if ($encodedKeys[$originalKey] & static::VALUE_UTF8ENCODED) {
                    $value = mb_convert_encoding($value, '8bit', 'UTF-8');
                }
            }

            $decodedData[$key] = $value;
        }

        return $decodedData;
    }
769060
protected static function xml2Data($xml)
    {
        $result = null;
        is_object($xml) && $xml = (array)$xml;
        if (is_array($xml)) {
            foreach ($xml as $key => $value) {
                $res = static::xml2Data($value);
                if (('@attributes' === $key) && ($key)) {
                    $result = $res;
                } else {
                    $result[$key] = $res;
                }
            }
        } else {
            $result = $xml;
        }
        return $result;
    }
206391
public function encodeData(array $data)
    {
        $output = array();
        foreach ($data as $key => $value) {
            $output[] = $key.'['.strlen($value).']='.$value;
        }

        return implode('&', $output);
    }
51359
public function xssClean(array $data)
    {
        foreach ($data as $k => $v) {
            $data[$k] = filter_var($v, FILTER_SANITIZE_STRING);
        }

        return $data;
    }
392169
protected function cleanData(array $data): array
    {
        $options = $this->getOptions();

        $disallowedDataKeys = array(
            $options->getIdColumnName(),
            $options->getLeftColumnName(),
            $options->getRightColumnName(),
            $options->getLevelColumnName(),
            $options->getParentIdColumnName(),
        );

        if (null !== $options->getScopeColumnName()) {
            $disallowedDataKeys[] = $options->getScopeColumnName();
        }

        return array_diff_key($data, array_flip($disallowedDataKeys));
    }
1105283
protected function rename(array $data): array
    {
        $result = [];
        foreach ($data as $dataItem) {
            list($keyId, $dataTmp) = $this->getKeyValue($dataItem);

            if ($keyId === null) {
                $result[] = $dataTmp;
            } else {
                $result[$keyId] = $dataTmp;
            }
        }

        return $result;
    }
660662
public function xssFunc($data)
    {
        if (!\is_array($data)) {
            return Security::detectXss($data);
        }

        $results = Security::detectXssFromArray($data);
        $results_parts = array_map(function($value, $key) {
            return $key.': \''.$value . '\'';
        }, array_values($results), array_keys($results));

        return implode(', ', $results_parts);
    }
535982
public static function fromArray(array $data)
    {
        $result = '';
        foreach ($data as $name => $value) {
            $value = StringHelper::toString($value, "'", Serialize::SERIALIZE_JSON);
            $result .= "$name=$value; ";
        }

        return $result === '' ? null : rtrim($result);
    }
1331796
private static function filterEscape($data)
    {
        return array_filter(array_map(function ($elem) {
            if (is_array($elem)) {
                return self::filterEscape($elem);
            }
            return addslashes($elem); // @codingStandardsIgnoreLine
        }, $data));
    }
731130
protected function normalizeArray(array $data)
    {
        $ret = [];

        foreach ($data as $key => $value) {
            if (!\is_string($key)) {
                continue;
            }

            $ret[$key[0]] = [
                'value' => $value,
                'pattern' => $key,
            ];
        }

        return $ret;
    }
1161710
public static function clean($data) {
		// String?
		if (!is_array($data)) return $data;
		// Needs a good scrubbing...
		$out = [];
		$whitelist = ['.priority'];
		// Recursive iterator to sanitize all keys (and flatten object values)
		foreach ($data as $key => $value) {
			$key = (in_array($key, $whitelist) !== false) ? $key : preg_replace('/[\.\#\$\/\[\]]/i', '', $key);
			if (is_object($value)) $value = $value->__toString();
			if (is_array($value) || is_object($value)) {
				$out[$key] = self::clean($value);
			} else {
				$out[$key] = $value;
			}
		}
		return $out;
	}
571644
private static function toXml($data)
    {
        assert(is_array($data) || $data instanceof Traversable);

        $node = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><root />");

        return self::addDataToNode($node, $data)->asXML();
    }
1239851
public function arraySerialize(array $Data)
    {
        $Result = "";
        foreach ($Data as $Value) {
            if ($Result == "") {
                $Result = floor($Value);
            } else {
                $Result = $Result . "," . floor($Value);
            }
        }

        return $Result;
    }
578095
public static function implode_pk($data)
	{
		if (count(static::$_primary_key) == 1)
		{
			$p = reset(static::$_primary_key);
			return (is_object($data)
				? strval($data->{$p})
				: (isset($data[$p])
					? strval($data[$p])
					: null));
		}

		$pk = '';
		foreach (static::$_primary_key as $p)
		{
			if (is_null((is_object($data) ? $data->{$p} : (isset($data[$p]) ? $data[$p] : null))))
			{
				return null;
			}
			$pk .= '['.(is_object($data) ? $data->{$p} : $data[$p]).']';
		}

		return $pk;
	}