Returns a new map containing key-value mapping from specified array

@param array $array
@return static
@throws TypeError
328898
public static function createFromArray(array $array): self
    {
        $map = new self;

        foreach ($array as $key => $value) {
            $map->put($key, $value);
        }

        return $map;
    }
596005
public static function flatten(array $array)
    {
        $result = array();

        array_walk_recursive($array, function ($value, $key) use (& $result) {
            if (is_numeric($key) or is_object($value)) {
                $result[] = $value;
            } else {
                $result[$key] = $value;
            }
        });

        return $result;
    }
157566
public static function flatten(array $array)
    {
        $out = [];

        foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key => $item) {
            if (is_int($key)) {
                $out[] = $item;
            } else {
                $out[$key] = $item;
            }
        }

        return $out;
    }
406952
public static function createFromAttributeArray(array $array)
	{
		$input = array_change_key_case($array, CASE_LOWER);

		$response = new Response();

		foreach (Response::$attributeMapping as $attribute => $localVariable) {
			$loweredAttribute = strtolower($attribute);

			if (array_key_exists($loweredAttribute, $input)) {
				$response->{$localVariable} = $input[$loweredAttribute];
			}
		}

		return $response;
	}
897823
public static function makeHashFromArray($array)
        {
            $hash = null;

            if (static::is($array) && count($array) > 1) {
                for ($i = 0; $i <= count($array); $i+= 2) {
                    if (isset($array[$i])) {
                        $key = $array[$i];
                        $value = $array[$i + 1];

                        if (!empty($key) && !empty($value)) {
                           $hash[$key] = $value;
                        }
                    }
                }
            }

            if (true === static::is($hash)) {
                return $hash;
            }
        }
892943
public static function arrayPluck($array, $key)
    {
        return array_map(function($value) use ($key) {
            return is_object($value) ? $value->$key : $value[$key];
        }, $array);
    }
88836
public static function arrayClone(array $array)
    {
        return array_map(function ($element) {
                return ((is_array($element))
                    ? call_user_func(__FUNCTION__, $element)
                    : ((is_object($element))
                        ? clone $element
                        : $element
                    )
                );
        }, $array);
    }
775455
private static function __s_array($array)
    {
        $border    = new Border(Border::TYPE_FRAME);
        $structure = new Structure(Structure::TYPE_ARRAY, '', null, '|', $border);

        return static::buildStructure($array, $structure);
    }
205851
public static function arrayMap(callable $callback, array $array)
    {
        foreach ($array as $key => $value) {
            $array[$key] = \call_user_func($callback, $value, $key);
        }

        return $array;
    }
1039860
public static function keys($array, $prefix = null)
    {
        $keys = array_keys($array);

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

        return $keys;
    }
254036
public static function type($array)
	{
	    $last_key = -1;
	    $type = 'index';

	    foreach( $array as $key => $val )
	    {
	        if( !is_int( $key ) || $key < 0 )
	        {
	            return 'assoc';
	        }

	        if( $type !== 'sparse' ) 
	        {
		        if( $key !== $last_key + 1 ){
		            $type = 'sparse';
		        }
		        $last_key = $key;
		    }
	    }

	    return $type;
	}
1012481
static public function sortByKeyRecursive(array $array)
    {
        ksort($array);
        foreach ($array as $key => $value) {
            if (is_array($value) && !empty($value)) {
                $array[$key] = self::sortByKeyRecursive($value);
            }
        }

        return $array;
    }
1100568
public static function flatten($array)
    {
        $return = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $return = \array_merge($return, static::flatten($value));
            } elseif ($value instanceof Collection) {
                $return = \array_merge($return, static::flatten($value->all()));
            } else {
                $return[$key] = $value;
            }
        }

        return $return;
    }
1002384
public function fromArray(array $array, $clear = false)
  {
    if ($clear) {
      $this->vars = array();
    }

    foreach ($array as $key => $val) {
      $this->set($key, $val);
    }

    return $this;
  }
157441
public static function expand($array)
    {
        $multiArray = [];

        foreach ($array as $key=>&$value)
        {
            $keys = explode('.', $key);
            $lastKey = array_pop($keys);
            $currentPointer = &$multiArray;

            foreach ($keys as $currentKey)
            {
                if (!isset($currentPointer[$currentKey]))
                {
                    $currentPointer[$currentKey] = [];
                }

                $currentPointer = &$currentPointer[$currentKey];
            }

            $currentPointer[$lastKey] = $value;
        }

        return $multiArray;
    }
796388
protected function createFromArray($array)
    {
        $this->id = $array['id'];
        $this->modelType = $array['modelType'];
        $this->modelId = $array['modelId'];
        $this->name = $array['name'];
        $this->price = $array['price'];
        $this->image = $array['image'];
        $this->quantity = $array['quantity'];

        return $this;
    }
844618
function array_map_deep($array, $callback) {
        $new = array();
        if(is_array($array)) foreach ($array as $key => $val) {
            if (is_array($val)) {
                $new[$key] = $this->array_map_deep($val, $callback);
            } else {
                $item = call_user_func($callback, $key, $val);
                $new[$item['key']] = $item['item'];
            }
        }
        else $new = call_user_func($callback, $array);
        return $new;
    }