Populates $this with the values of an associative Array.
Array keys must match column names to be used.
@param array $array
@return static
18408
function fromArray($array) {
		if (!is_array($array) && !is_object($array)) {
			throw new RuntimeException('Argument must be array or object');
		}
		foreach ($array as $column => &$v) {
			if (
				is_string($column) === false
				|| !isset(static::$_columns[$column])
			) {
				continue;
			}
			$this->{'set' . $column}($v);
		}
		return $this;
	}
1370069
public static function createFromArray(array $array): self
    {
        $hashMap = new self;

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

        return $hashMap;
    }
47292
public static function createFromArray(array $array)
    {
        $scoreStrategies = new self();
        $scoreStrategies->scoreMode = $array['score_mode'] ?: self::SUM;
        $scoreStrategies->scoreStrategies = array_map(function (array $scoreStrategy) {
            return ScoreStrategy::createFromArray($scoreStrategy);
        }, $array['score_strategies']);

        return $scoreStrategies;
    }
328898
public static function createFromArray(array $array): self
    {
        $map = new self;

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

        return $map;
    }
508929
public static function fromObjects($array, $key) {
        $elements = array();
        foreach ($array as $element) {
            $result = call_user_func(array($element, $key));
            $elements = array_merge($elements, is_array($result) ? $result : array($result));
        }
        return new self($elements);
    }
621979
public static function expand(array $array)
    {
        $result = array();

        foreach ($array as $key => $value) {
            $references = self::explodeKeys((string)$key); // cast for performance
            $value = self::expandValue($value);

            if (count($references) === 1) {
                $key = $references[0];

                // If the result key is already set, we have to merge
                // the two values.
                if (array_key_exists($key, $result)) {
                    $result[$key] = self::mergeTwoValues($result[$key], $value, array($key));
                }
                else {
                    $result[$key] = $value;
                }
            }
            else {
                self::dereferenceDots($result, $references, $value);
            }
        }

        return $result;
    }
1370676
private function _fromAssociativeArray(array $array)
    {
        foreach ($this->_fields as $fieldName => $field) {
            $fieldType = $field['FieldType'];   
            if (is_array($fieldType)) {
                if ($this->_isComplexType($fieldType[0])) {
                    if (array_key_exists($fieldName, $array)) { 
                        $elements = $array[$fieldName];
                        if (!$this->_isNumericArray($elements)) {
                            $elements =  array($elements);    
                        }
                        if (count ($elements) >= 1) {
                            // // require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $fieldType[0]) . ".php");

                            foreach ($elements as $element) {
                                $this->_fields[$fieldName]['FieldValue'][] = new $fieldType[0]($element);
                            }
                        }
                    } 
                } else {
                    if (array_key_exists($fieldName, $array)) {
                        $elements = $array[$fieldName];
                        if (!$this->_isNumericArray($elements)) {
                            $elements =  array($elements);    
                        }
                        if (count ($elements) >= 1) {
                            foreach ($elements as $element) {
                                $this->_fields[$fieldName]['FieldValue'][] = $element;
                            }
                        }  
                    }
                }
            } else {
                 if ($this->_isComplexType($fieldType)) {
                    if (array_key_exists($fieldName, $array)) {
                        // // require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $fieldType) . ".php");
                        $this->_fields[$fieldName]['FieldValue'] = new $fieldType($array[$fieldName]);
                    }   
                 } else {
                    if (array_key_exists($fieldName, $array)) {
                        $this->_fields[$fieldName]['FieldValue'] = $array[$fieldName];
                    }
                 }
            }
        }
    }
1163740
public static function createFromArray(?array $array): ?BinarySearchTree {
        if (null === $array) {
            return null;
        }
        $tree = new BinarySearchTree();
        if (0 === \count($array)) {
            return $tree;
        }
        foreach ($array as $element) {
            if (null === $element) {
                continue;
            }
            $tree->insertValue($element);
        }
        return $tree;
    }
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;
            }
        }
838832
public function loadFromArray(array $array)
    {
        if (isset($array['filename'])) {
            $this->filename = $array['filename'];
        }

        if (isset($array['size'])) {
            $this->size = $array['size'];
        }

        if (isset($array['type'])) {
            $this->type = $array['type'];
        }

        if (isset($array['cid'])) {
            $this->cid = $array['cid'];
        }

        if (isset($array['href'])) {
            $this->href = $array['href'];
        }

        return $this;
    }
1047296
public static function createFromArray(array $array): self
    {
        $result = self::create(
            $array['query_uuid'] ?? '',
            $array['total_items'] ?? 0,
            $array['total_hits'] ?? 0,
            isset($array['aggregations'])
                ? Aggregations::createFromArray($array['aggregations'])
                : null,
            $array['suggests'] ?? [],
            array_map(function (array $item) {
                return Item::createFromArray($item);
            }, $array['items'] ?? [])
        );

        $result->subresults = array_filter(
            array_map(function (array $subresultAsArray) {
                return Result::createFromArray($subresultAsArray);
            }, $array['subresults'] ?? [])
        );

        return $result;
    }
1196141
public static function fromArray($array)
    {
        if (!is_array($array) && !($array instanceof \Traversable)) {
            throw new \InvalidArgumentException(sprintf(
                'Dictionary::fromArray() argument must be array or Traversable, '
                . 'but is "%s".', gettype($array)
            ));
        }

        $result = new Dictionary();
        foreach ($array as $key => $value) {
            $result[$key] = $value;
        }
        return $result;
    }
1005376
public static function arrayToObject($array)
    {
        $obj = new \stdClass();
        foreach($array as $k => $v)
        {
            if(strlen($k))
            {
                if(is_array($v) && count($v) > 0)
                {
                    // recursive
                    $instance = new static;
                    $obj->{$k} = $instance->arrayToObject($v);
                }
                else
                {
                    $obj->{$k} = $v;
                }
            }
        }
        return $obj;
    }
975100
private function fromAssociativeArray(array $array)
    {
        foreach ($this->fields as $fieldName => $field) {
            $fieldType = $field['FieldType'];   
            if (is_array($fieldType)) {
                if ($this->isComplexType($fieldType[0])) {
                    if (array_key_exists($fieldName, $array)) { 
                        $elements = $array[$fieldName];
                        if (!$this->isNumericArray($elements)) {
                            $elements =  array($elements);    
                        }
                        if (count ($elements) >= 1) {
                            require_once (str_replace('_', DIRECTORY_SEPARATOR, $fieldType[0]) . ".php");
                            foreach ($elements as $element) {
                                $this->fields[$fieldName]['FieldValue'][] = new $fieldType[0]($element);
                            }
                        }
                    } 
                } else {
                    if (array_key_exists($fieldName, $array)) {
                        $elements = $array[$fieldName];
                        if (!$this->isNumericArray($elements)) {
                            $elements =  array($elements);    
                            }
                        if (count ($elements) >= 1) {
                            foreach ($elements as $element) {
                                $this->fields[$fieldName]['FieldValue'][] = $element;
                            }
                        }  
                    }
                }
            } else {
                if ($this->isComplexType($fieldType)) {
                    if (array_key_exists($fieldName, $array)) {
                        require_once (str_replace('_', DIRECTORY_SEPARATOR, $fieldType) . ".php");
                        $this->fields[$fieldName]['FieldValue'] = new $fieldType($array[$fieldName]);
                    }   
                } else {
                    if (array_key_exists($fieldName, $array)) {
                        $this->fields[$fieldName]['FieldValue'] = $array[$fieldName];
                    }
                }
            }
        }
    }
1235518
public function fill(array $data)
    {
        foreach ($data as $column => $value) {
            $this->__set($column, $value);
        }
        return $this;
    }
777098
public function fromArray( $array ){
		foreach( $array as $key => $value ){
			if( is_array( $value ) ){
				$this->__set( $key, NULL );
				$this->data[$key]->fromArray( $value );
			}
			else{
				$this->__set( $key, $value );
			}
		}

	}
232835
public function setArray(array $array)
    {
        $this->array = array_values($array);
        $this->arraySize = count($this->array);
        $this->rewind();

        return $this;
    }