Strips metadata that should not be stored

@param array $array
@param array $stripped
@return array
549218
protected function stripMetadata(array $array, $stripped = [])
    {
        $allowed = ['id', '__children'];
        foreach ($array as $item) {
            if (count($item['__children'])) {
                $item['__children'] = $this->stripMetadata($item['__children'], $stripped);
            }

            $stripped[] = array_intersect_key($item, array_flip($allowed));
        }

        return $stripped;
    }
1269565
public static function cleanupArray($array)
    {
        $newArray = [];

        $array = static::toArray($array);

        foreach ($array as $key => $val) {

            if (is_array($val)) {
                $val = static::cleanupArray($val);
            } else {
                $val = trim($val);
                if (!$val) {
                    continue;
                }
            }

            $newArray[$key] = $val;
        }

        return $newArray;
    }
920431
private function trimArray($array)
    {
        foreach ($array as $key => $value) {
            // Do not attemp to trim array variables, boolean variables, or the proxy password
            // Trimming a boolean value (as a string) may not produce the expected output, so pass it through as-is
            if (!is_array($value) && !is_bool($value) && $key !== 'proxy_password') {
                $array[$key] = trim($value);
            }
        }
        return $array;
    }
1056230
private function removeValuesWithPasswordKeys($array, &$passwordRemoved = false)
    {
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $value = $this->removeValuesWithPasswordKeys($value, $removedChild);
                if ($removedChild) {
                    $array[$key] = $value;
                    $passwordRemoved = true;
                }
            } else {
                foreach ($this->auditRequestIgnoreKeys as $ignoreKey) {
                    if (stripos($key, $ignoreKey) !== false) {
                        $array[$key] = '*password removed*';
                        $passwordRemoved = true;
                        continue;
                    }
                }
            }
        }
        return $array;
    }
392515
protected function filterArray(array $array): array
	{
		$newArray = [];

		foreach($array as $row)
		{
			$newArray[] =  (is_array($row)) ? $row[0] : $row;
		}

		return $newArray;
	}
1346632
public static function without(array $array, array $ignore): array
    {
        foreach ($array as $key => $node) {
            if (in_array($node, $ignore, true)) {
                unset($array[$key]);
            }
        }

        return array_values($array);
    }
829886
public function unredislizeArray(array $data)
    {
        $result = [];
        foreach ($data as $key => $value) {
            $result[$key] = $this->unredislize($value);
        }

        return $result;
    }
342022
public static function filter_suffixed($array, $suffix, $remove_suffix = true)
    {
        $return = [];
        foreach ($array as $key => $val) {
            if (preg_match('/'.$suffix.'$/', $key)) {
                if ($remove_suffix === true) {
                    $key = preg_replace('/'.$suffix.'$/', '', $key);
                }
                $return[$key] = $val;
            }
        }
        return $return;
    }
390628
public function strip(array $keys) : Assoc
    {
        return $this->pipe(
            function (array $values) use ($keys) : array {
                foreach ($keys as $key) {
                    if (isset($values[$key])) {
                        unset($values[$key]);
                    }
                }

                return $values;
            }
        );
    }
1311376
public function syncMeta($array)
    {
        $meta = [];

        foreach ($array as $key => $value) {
            $meta[$key] = $this->makeMeta($key, $value);
        }

        $this->meta()->delete();
        $this->meta()->saveMany($meta);

        // Update cached relationship.
        $collection = $this->makeMeta()->newCollection($meta);
        $this->setRelation('meta', $collection);
    }
858813
public static function remove(array $array, string $key): array
    {
        // Extract key/path.
        $keyLast = Str::last($key, '.');
        $key = Str::removeLast($key, '.');

        // If found, remove element.
        $arrayElement = &self::dataByPath($array, $key, false, 'not.found');
        if ($arrayElement !== 'not.found') {
            if (array_key_exists($keyLast, $arrayElement)) {
                unset($arrayElement[$keyLast]);
            }
        }

        return $array;
    }
917838
public function quoteArray(array $array): array
    {
        if (empty($array)) {
            return [];
        }
        foreach ($array as $key => $value) {
            if ($value instanceof RawExp) {
                $array[$key] = $value->getValue();
                continue;
            }

            $array[$key] = $this->quoteValue($value);
        }

        return $array;
    }
757879
protected function removeNullElements($array)
    {
        foreach ($array as $key => $val) {
            if (is_array($val)) {
                $array[$key] = $this->removeNullElements($val);
            } elseif (is_null($val)) {
                unset($array[$key]);
            }
        }

        return $array;
    }
1304505
public static function filter_prefixed($array, $prefix, $removePrefix = true)
    {
        $return =[];
        foreach ($array as $key => $val) {
            if (preg_match('/^'.$prefix.'/', $key)) {
                if ($removePrefix === true) {
                    $key = preg_replace('/^'.$prefix.'/','',$key);
                }
                $return[$key] = $val;
            }
        }
        return $return;
    }
81745
protected function sanitizeArray($array)
    {
        foreach($array as $key => $value){
            if(is_array($value)){
                $array[$key] = $this->sanitizeArray($value);
            } else {
                $array[$key] = $this->convertStaticPhpExcelConstantsFromStringsToConstants($value);
            }
        }

        return $array;
    }
901737
private function convertField($array)
    {
        $result = [];

        // Copy over well known keys.
        foreach (static::$convertFields as $key) {
            if (isset($array[$key])) {
                $result[$key] = $array[$key];
            }
        }

        if (isset($array['dataType'])) {
            $result['dataType'] = $this->inferType($array['dataType']);
        } else {
            $result['dataType'] = isset($array['children']) ? 'object' : DataTypes::STRING;
        }

        $result['required'] = isset($array['required']) && (bool) $array['required'];
        $result['readonly'] = isset($array['readonly']) && (bool) $array['readonly'];

        $result = $this->convertChildren($array, $result);

        return $result;
    }
651619
private function _convertDottedPropertiesToArray(&$array)
    {
        foreach ($array as $section => $sectionArray) {

            $merged = array();

            foreach ($sectionArray as $key => $value) {

                $property = $this->_dotToArray($key, $value);
                $merged = array_merge_recursive($merged, $property);
            }

            $array[$section] = $merged;
        }
    }