Method to recursively convert data to one dimension array.

@param   array|object  $array      The array or object to convert.
@param   string        $separator  The key separator.
@param   string        $prefix     Last level key prefix.

@return  array
320695
public static function flatten($array, $separator = '.', $prefix = '')
	{
		$return = array();

		if ($array instanceof \Traversable)
		{
			$array = iterator_to_array($array);
		}
		elseif (is_object($array))
		{
			$array = get_object_vars($array);
		}

		foreach ($array as $k => $v)
		{
			$key = $prefix ? $prefix . $separator . $k : $k;

			if (is_object($v) || is_array($v))
			{
				$return = array_merge($return, static::flatten($v, $separator, $key));
			}
			else
			{
				$return[$key] = $v;
			}
		}

		return $return;
	}
503661
protected static function flatArray(array &$result, array $array, $connector = '.', $prefix = null)
    {
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                static::flatArray($result, $value, $connector, $prefix.$key.$connector);
                continue;
            }

            $result[$prefix.$key] = $value;
        }
    }
535625
public function split($separator)
    {
        $hash = new Hash(explode((string) $separator, (string) $this));

        return $hash->map(
            function ($value) {
                return new String($value);
            }
        );
    }
593019
public static function toArray($stringOrArray, string $separator = '.'): array
    {
        if (is_string($stringOrArray)) {
            if (trim($stringOrArray) !== '') {
                $stringOrArray = explode($separator, $stringOrArray);
            }
        }
        if (!is_array($stringOrArray)) {
            return [];
        }
        return $stringOrArray;
    }
248986
public function prefixArrayKeys($prefix, $array)
    {
        return array_combine(array_map(function ($key) use ($prefix) {
            return $prefix.$key;
        }, array_keys($array)), array_values($array));
    }
319472
public static function flattenExtended($array, $keyPrefix = '', $delimeter = '.', $trimAsNULL = TRUE)
	{
		$keyPrefix = trim($keyPrefix);
		$flat = [];
		foreach ($array as $key => $value) {
			$newKey = $keyPrefix . $key;
			if (static::is_array($value)) {
				$flat[Valid::digit($newKey) ? (int) $newKey : $newKey] = $value;
				$flat = static::merge($flat, static::flattenExtended($value, $newKey . $delimeter, $delimeter));
			} else {
				$flat[Valid::digit($newKey)	? (int) $newKey	: $newKey] = $trimAsNULL
					? Helpers_Text::trimAsNULL($value)
					: $value;
			}
		}

		return $flat;
	}
20894
private function applyPrefix(array $array, $prefix = null)
    {
        if ($prefix === null) {
            return $array;
        }

        $result = [];
        foreach ($array as $key => $value) {
            $result[$prefix . self::PREFIX_GLUE . $key] = $value;
        }

        return $result;
    }
631786
public static function values($array, $prefix = null)
    {
        $values = array_values($array);

        if (! empty($prefix)) {
            $values = static::prefix($values, $prefix);
        }

        return $values;
    }
573317
public static function stripPrefix(string $data, string $prefix, string $separator = ''): string
    {
        if ($data === '') {
            return $data;
        }
        if ($separator !== '') {
            $data = ltrim($data, $separator);
        }
        if (static::substr($data, 0, static::length($prefix)) === $prefix) {
            $data = static::substr($data, static::length($prefix));
        }
        if ($separator !== '') {
            $data = ltrim($data, $separator);
        }
        return $data;
    }
1235366
public static function flatten($array)
    {
        if (!is_array($array)) {
            // nothing to do if it's not an array
            return array($array);
        }

        $result = array();
        foreach ($array as $value) {
            // explode the sub-array, and add the parts
            $result = array_merge($result, static::flatten($value));
        }

        return $result;
    }
958395
public static function arrayToString(array $array, $delimiter = ""): string {
        $string = "";
        foreach ($array as $value) {
            if (\is_array($value)) {
                $string .= ArrayUtil::arrayToString($value, $delimiter) . $delimiter;
            } else {
                $string .= $value . $delimiter;
            }
        }
        return $string;
    }
1326310
public static function flatten(array $array, string $separator = null, string $prepend = ''): array
    {
        $flattened = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flattened = array_merge($flattened, static::flatten($value, $separator, $prepend . $key . $separator));
            } else {
                $flattened[$prepend . $key] = $value;
            }
        }

        return $flattened;
    }
880218
public function flattenArray($array)
    {
        $result = [];
        foreach (array_dot($array) as $key => $value) {
            $splitKey = explode('.', $key);
            $newKey = $this->createArrayKey($splitKey);
            $result = array_merge($result, [$newKey => $value]);
        }

        return $result;
    }
329772
public function flatAssocArray(array $array)
	{
		$ret = [];
		foreach ($array as $key => $value) {
			if (is_array($value)) {
				$ret += $this->flatAssocArray($value);
			}
			else {
				$ret[ $key ] = $value;
			}
		}

		return $ret;
	}
834641
public static function flatten($array)
    {
        $isAssoc = self::isAssoc($array);

        $flat = [];
        foreach ($array as $key => $value)
        {
            if (is_array($value))
            {
                $flat = array_merge($flat, self::flatten($value));
            }
            else
            {
                if ($isAssoc)
                {
                    $flat[$key] = $value;
                }
                else
                {
                    $flat[] = $value;
                }
            }
        }

        return $flat;
    }
1035119
public static function remove(&$array, $path, $separator = "."){
        $nodes = explode($separator, $path);
        $key = array_pop($nodes);
        $parent = implode($separator, $nodes);

        $siblings = self::getFromPath($array, $parent, $separator);
        unset($siblings[$key]);
        self::setFromPath($array, $parent, $siblings, $separator);

        return $array;
    }
953150
public function split($separator)
    {
        $temp = explode($separator, $this->toString());
        $list = ArrayList::asType($this->getClassName(), $temp);
        return $list;
    }