Extract multiple objects.
@param  array $array
@return array
331357
public function extractAll(array $array, int $depth = 1)
    {
        $depth--;
        $res = [];
        foreach ($array as $key => $object) {
            $res[$key] = $depth>0 ? $this->extractAll($object, $depth) : $this->extract($object);
        }

        return $res;
    }
769828
private function getList($array)
    {
        $list = array();
        foreach ($array as $key => $value) {
            $list[] = !is_array($value) ? $value : $this->getList($v);
        }

        return '(' . implode(' ', $list) . ')';
    }
1078802
public static function getListFromArray(array $array) {
		$n=count($array);
		switch ($n) {
			case 0:
				return '';
			case 1:
				return $array[0];
			default:
				return implode(
						/* I18N: list separator */ I18N::translate(', '), 
						array_slice($array, 0, $n-1)
					) .
					/* I18N: last list separator, " and " in English, " et " in French  */ I18N::translate(' and ') . 
					$array[$n-1];
		}
	}
18642
public static function pluck(array $array, $key)
    {
        return array_map(
            function ($item) use ($key) {
                return is_object($item) ? $item->$key : $item[$key];
            },
            $array
        );
    }
179047
public static function ArrayAsObject($Array) {
      if (!is_array($Array))
         return $Array;

      $Return = new stdClass();
      foreach($Array as $Property => $Value) {
         $Return->$Property = $Value;
      }
      return $Return;
   }
272631
function getKeysForDuplicates(array $array)
    {
        $duplicates = $newArray = [];

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

            if ( ! isset($newArray[ $value ])) {
                $newArray[ $value ] = $key;
                continue;
            }

            if (isset($duplicates[ $value ])) {
                $duplicates[ $value ][] = $key;
            } else {
                $duplicates[ $value ] = [
                    $newArray[ $value ],
                    $key
                ];
            }
        }

        return $duplicates;
    }
1179318
public function regex($array = [])
    {
        $filtered = [];
        foreach ($array as $key => $value) {
            if ($this->isRegex($key)) {
                $filtered[$key] = $value;
            }
        }

        return $filtered;
    }
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;
    }
129517
public static function pluck( $array, $key ) {
		$return = array();
		foreach ( $array as $obj ) {
			if ( is_object($obj) && method_exists($obj, $key) ) {
				$return[] = $obj->$key();
			} elseif ( is_object($obj) && property_exists($obj, $key) ) {
				$return[] = $obj->$key;
			} elseif ( is_array($obj) && isset($obj[$key]) ) {
				$return[] = $obj[$key];
			}
		}
		return $return;
	}
246310
private function deserializeArrayRecursively(array $array): array
    {
        $data = [];
        foreach ($array as $key => $value) {
            $data[$key] = $this->deserializeValue($value);
        }

        return $data;
    }
1110967
public static function flatten($array = [])
    {
        $items = [];
        foreach ($array as $value) {
            if (is_array($value)) {
                $items = array_merge($items, self::flatten($value));
            } else {
                $items[] = $value;
            }
        }
        return $items;
    }
1218840
public static function arrayObject($array)
    {
        if (is_array($array)) {
            $object = new \stdClass();
            foreach ($array as $key => $value) {
                if (is_array($value)) {
                    $object->$key = static::arrayObject($value);
                } else {
                    $object->$key = $value;
                }
            }

            return (object) $object;
        }

        return false;
    }
1033343
private function arrayFilterRecursive(array &$array)
    {
        foreach ($array as $key => &$item) {
            is_array($item) && $array[$key] = $this->arrayFilterRecursive($item);
            if ($array[$key] === null ||
                $array[$key] === []
            ) {
                unset($array[$key]);
            }
        }
        return $array;
    }
1220548
private function decodeArray($array) {

        $return_value = array();

        foreach ( $array->data->value as $value ) {

            $return_value[] = $this->decodeValue($value);

        }

        return $return_value;

    }
832560
public static function getValues($array)
    {
        settype($array, 'array');
        $values = array();
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $values = array_merge($values, self::getValues($value));
            } else {
                $values[] = $value;
            }
        }

        return $values;
    }
905182
protected function doCreateObject(array $array)
    {
        $catalogItem                 = new CatalogItem($array);
        $catalogItem->filterSettings = json_decode((string)$catalogItem->filterSettings, true);

        return $catalogItem;
    }
739435
public static function formatResponseArray(array $array): array
    {
        $formattedArray = [];

        foreach ($array as $item) {
            reset($item);
            $formattedArray[key($item)] = current($item);
        }

        return $formattedArray;
    }