@abstract    Normalize Array or ArrayObject to Array

@param null|array|ArrayObject $data

@return array
172261
private static function toArray($data) : array
    {
        if (($data instanceof ArrayObject)) {
            return $data->getArrayCopy();
        }
        if (is_null($data) || empty($data)) {
            return array();
        }

        return $data;
    }
1243550
public function transform($data)
    {
        if (is_array($data)) {
            return array_map([$this, 'parseNumeric'], $data);
        }

        return $this->parseNumeric($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;
    }
1258794
public function redislizeArray(array $data)
    {
        $result = [];
        foreach ($data as $key => $value) {
            if (!is_array($value)) {
                $result[$key] = $this->redislize($value);
            }
        }

        return $result;
    }
569039
private function convertData(array $data = null)
    {
        if (!is_array($data)) {
            return $data;
        }

        foreach ($data as $key => $val) {
            /** convert dbrefs */
            if (is_array($val) && isset($val['$ref']) && isset($val['$id'])) {
                $data[$key] = $this->convertData(
                    $this->resolveObject($val['$ref'], $val['$id'])
                );
            } elseif (is_array($val)) {
                $data[$key] = $this->convertData($val);
            }
            /** convert mongodate to text dates **/
            if ($val instanceof \MongoDate) {
                $data[$key] = $this->dateConverter->formatDateTime($val->toDateTime());
            }
            /** convert mongoid */
            if ($val instanceof \MongoId) {
                $data[$key] = (string) $val;
            }
        }

        return $data;
    }
1087463
private function normalizeArrayForNewLines(array $data) {
		foreach($data as $k => $item) {
			if(is_string($item)) {
				$data[$k] = str_replace(["\r\n", "\n\r", "\r"], "\n", $item);
			} elseif(is_array($item)) {
				$data[$k] = $this->normalizeArrayForNewLines($item);
			}
		}
		return $data;
	}
921049
public function toObject(array $data)
    {
        $data = json_decode(json_encode($data));

        if ($data === []) {
            $data = new \StdClass();
        }

        return $data;
    }
1053129
protected function _normalizeResult(array $data): array
    {
        $result = [];
        for ($i = 0; $i < $data['count']; $i++) {
            $item = $data[$i];

            // construct label
            preg_match('/^.*?,OU=(.*?),/i', $item['dn'], $match);
            $label = !empty($match[1]) ? $match[1] . ' / ' . $item['cn'][0] : $item['cn'][0];

            $result[$item['dn']] = $label;
        }

        asort($result);

        return $result;
    }
234781
public static function deserializeObject(array $data)
    {
        $result = new static($data['resourceType'], isset($data['created']) ? Helper::string2dateTime($data['created']) : null);
        if (isset($data['lastModified'])) {
            $result->lastModified = Helper::string2dateTime($data['lastModified']);
        }
        if (isset($data['location'])) {
            $result->location = $data['location'];
        }
        if (isset($data['version'])) {
            $result->version = $data['version'];
        }

        return $result;
    }
91126
protected function _toArray($data)
    {
        $array = array();

        foreach ($data as $key => $value) {
            if (is($value, 'AnDomainBehaviorSerializable')) {
                $array[$key] = $value->toSerializableArray();
            } elseif (is_array($value)) {
                $array[$key] = $this->_toArray($value);
            } else {
                $array[$key] = $value;
            }
        }

        return $array;
    }
92273
private function convertSerializedToArray($data)
    {
        $data = @unserialize($data);

        // Maybe the response was a serialized JSON string
        // So let's try to convert that to an array...
        if (is_string($data))
        {
            return $this->convertJsonToArray($data);
        }

        // It could be an object or an array of object
        // but we want a associative array, so use
        // JSON to encode it and then decode it properly...
        if ((is_object($data) or is_array($data)) and $json = $this->convertToJson($data))
        {
            return $this->convertJsonToArray($json);
        }

        return null;
    }
605605
public function normalizeData(array $data): array
    {
        $normalizedMetaData = [];
        foreach ($data as $key => $value) {
            $normalizedKey = strtolower($key);
            $normalizedValue = $this->normalizeValues($normalizedKey, $value);
            $normalizedMetaData[$normalizedKey] = $normalizedValue;
        }

        return $normalizedMetaData;
    }
969600
public function transform($data)
    {
        if (is_array($data)) {
            return $data;
        }

        if (is_object($data) && $data instanceof Arrayable) {
            return $data->toArray();
        }

        return (array) $data;
    }
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);
		}
	}
122619
private function unserializeArray(array $data)
    {
        $unserialized = [];

        foreach ($data as $key => $value) {
            if ($value instanceof ObjectStub) {
                $unserialized[$key] = $value->getObject();

                continue;
            }

            $unserialized[$key] = is_array($value) ? $this->unserializeArray($value) : $value;
        }

        return $unserialized;
    }
450350
public static function map($data) {

        if(is_array($data) === true) {

            $array = self::arrayResolve($data);
        } else {

            $array = self::stringResolve($data);

        }

        return $array;
    }
1239851
public function arraySerialize(array $Data)
    {
        $Result = "";
        foreach ($Data as $Value) {
            if ($Result == "") {
                $Result = floor($Value);
            } else {
                $Result = $Result . "," . floor($Value);
            }
        }

        return $Result;
    }