Normalizes form data keys to map to their respective Omnipay parameters (in other words: reverses the effects
from the custom field name support)

@param array $data The form data consisting of key value pairs

@return array
166208
public function normalizeFormData(array $data)
    {
        if (empty($data)) {
            return $data;
        }

        $renameMap = array_flip($this->renamemap);

        foreach ($renameMap as $customName => $defaultName) {
            if (array_key_exists($customName, $data)) {
                $value = $data[$customName];
                unset($data[$customName]);
                $data[$defaultName] = $value;
            }
        }

        return $data;
    }
63114
protected function normalize(array $data)
    {
        $body = json_encode($data);

        if ($this->length($body) > static::MAX_SIZE) {
            unset($data['events'][0]['metaData']);
        }

        $body = json_encode($data);

        if ($this->length($body) > static::MAX_SIZE) {
            throw new RuntimeException('Payload too large');
        }

        return $data;
    }
1113503
public function denormalizeValue(array $data)
    {
        $processed = array();

        foreach ($data as $docId => $content) {
            $cloned = $content;
            $keys = array_keys($cloned);
            $ofType = array_pop($keys);
            $asArray = ('array' === $ofType)? true : false;

            $value = $content[$ofType];

            Assertion::isJsonString($value, 'Invalid json string in registry');

            $processed[$docId] = json_decode($value, $asArray);
        }

        return $processed;
    }
1133818
protected function normalize(array $data, int $n): array
    {
        if (count($this->means) === 0) {
            $this->calculateMeans($data, $n);
        }

        // Normalize data
        foreach (array_keys($data) as $i) {
            for ($k = 0; $k < $n; ++$k) {
                $data[$i][$k] -= $this->means[$k];
            }
        }

        return $data;
    }
125508
public function normalizeParameters(array $parameters)
    {
        $normalized = [];

        // [1] Encode both the keys and values.
        // Decode it frist, in case the given data is already encoded.
        foreach ($parameters as $key => $value) {
            $key = rawurlencode(rawurldecode($key));

            if (is_array($value)) {
                $normalized[$key] = $this->normalizeParameters($value);
            } else {
                $normalized[$key] = rawurlencode(rawurldecode($value));
            }
        }

        // [2] Sort by the encoded key.
        ksort($normalized);

        return $normalized;
    }
216752
public static function keys($data = false) {

        if ($data && Validate::isArray($data)) {

            return array_keys($data);
        } else if ($data && Validate::isObject($data)) {

            return get_object_vars($data);
        }

        return false;
    }
463283
public function applyOrderAndAliases(array $data)
    {
        if ($this->orderAndAliases === null) {
            return $data;
        }

        $processedData = [];

        foreach ($this->orderAndAliases as $key => $value) {
            if (\is_integer($key)) {
                $fieldName = $value;
                $fieldAlias = $value;
            } else {
                $fieldName = $key;
                $fieldAlias = $value;
            }

            $processedData[$fieldAlias] = null;
            if (array_key_exists($fieldName, $data)) {
                $processedData[$fieldAlias] = $data[$fieldName];
            }
        }

        return $processedData;
    }
383105
protected function normalizeFields()
    {
        $normalizedFields = [];
        foreach ($this->fields as $key => $field) {
            if ($this->isNumber($key)) {
                $direction = 1;
                if (substr($field, 0, 1) === '-') {
                    $direction = -1;
                }
                $normalizedFields[ltrim($field, '-+')] = $direction;
            } else {
                $normalizedFields[$key] = $field;
            }
        }
        $this->fields = $normalizedFields;
    }
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;
    }
633381
private function denormalizeData($data)
    {
        if (is_scalar($data) || $data === null) {
            return $data;
        }

        if (isset($data[$this->classAnnotation])) {
            return $this->denormalizeObject($data);
        }

        return array_map([$this, 'denormalizeData'], $data);
    }
547260
protected function decorateFieldData(array $data)
    {
        // Get the key-reference pairs required to fill the drop-down

        $referenceData = $this->getReferenceDataProvider()->getForModelClassByType(
            get_class($this->model),
            'form.field',
            $this->field->key()
        );

        if ($referenceData) {
            $references = $this->getReferenceRepository()->getReferencesForModelMetaReference($referenceData)->all();
        } else {
            $references = [];
        }

        $data['dropdownOptions'] = $references;

        return $data;
    }
560395
protected function asArray($data)
  {
    $array = [];
    
    foreach(get_object_vars((object)$data) as $k => $v){
      if ( is_object($v) ){
        $array[$k] = $this->asArray($v);
      }
      else {
        $array[$k] = $v;
      }
    }
    
    return $array;
  }
123320
public function getFieldValues(array $data) : array
    {
        $result = [];
        foreach ($this->getFields() as $field) {
            $result[$field] = array_key_exists($field, $data) ? $data[$field] : null;
        }

        return $result;
    }
1202281
private function formatCapabilities(array $data): array
    {
        $result = [];
        foreach ($data as $controller => $list) {
            $newList = [];
            foreach ($list as $type => $caps) {
                foreach ($caps as $cap) {
                    $field = $cap->getField();
                    $key = !empty($field) ? "${type}_(_${field}_)" : $type;
                    $newList[$key][] = $cap;
                }
            }
            $result[$controller] = $newList;
        }

        return $result;
    }
743799
public function sanitize($data)
    {
        if (is_array($data)) {
            $newArray = [];
            foreach ($data as $key => $value) {
                $newArray[$this->cleanKeys($key)] = $this->sanitize($value);
            }

            return $newArray;
        }

        if ($this->magicQuotesGpc === true) {
            // Get rid of those pesky magic quotes!
            $data = stripslashes($data);
        }

        return $this->xssClean($data);
    }
605309
private function normalizeData($data)
    {
        $normalizedData = [];

        foreach ($data as $key => $value) {
            if ('#text' === $key) {
                $key = 'direction';
            }

            $normalizedData[trim($key, '_')] = $value;
        }

        return $normalizedData;
    }
1194675
public function parseData(array $data)
    {
        $newData = [];

        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $value = $this->parseData($value);
            }

            // If the data key contains a dot, we will replace it with another character
            // sequence so it doesn't interfere with dot processing when working with
            // array based validation rules and array_dot later in the validations.
            if (Str::contains($key, '.')) {
                $newData[str_replace('.', '->', $key)] = $value;
            } else {
                $newData[$key] = $value;
            }
        }

        return $newData;
    }