Create from array.

@param array $array

@return self
183436
public static function createFromArray(array $array)
    {
        $scoreStrategy = new self();
        $scoreStrategy->type = $array['type'] ?: self::DEFAULT_TYPE;
        $scoreStrategy->configuration = $array['configuration'] ?? [];
        $scoreStrategy->weight = $array['weight'] ?? self::DEFAULT_WEIGHT;
        $scoreStrategy->scoreMode = $array['score_mode'] ?? self::SCORE_MODE_AVG;
        $scoreStrategy->filter = is_array($array['filter'])
            ? Filter::createFromArray($array['filter'])
            : null;

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

        return $this;
    }
696216
public function copyToArray(array &$array)
    {
        $array['start']      = $this->start;
        $array['end']        = $this->end;
        $array['developer']  = $this->developer;
        $array['totalCount'] = $this->totalCount;
        $array['clients']    = LanguageUtility::convertArrayOfArrayCopyableToArray($this->clients);
    }
1137041
public static function cloneArray(array $array): array
    {
        $newArray = [];
        foreach($array as $key => $value) {
            if(\is_object($value)) {
                $newArray[$key] = clone $value;
            } elseif(\is_array($value)) {
                $newArray[$key] = self::cloneArray($value);
            } else {
                $newArray[$key] = $value;
            }
        }
        return $newArray;
    }
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;
    }
1095869
public function hydrateFromArray(array $array)
    {
        $this->clear();

        //If this is a 0-indexed numerical key array, add 1 to all the keys so
        //it is a 1-indexed numerical key array
        if (current(array_keys($array)) === 0) {
            $array = array_combine(
                range(1, count($array)),
                array_values($array)
            );
        }

        foreach ($array as $key => $value) {
            $this->push(
                $this->wye->makeBinding($key, $value)
            );
        }

        return $this;
    }
656206
protected function fromArray(array $array)
    {
        if (is_array($array)) {
            foreach ($array as $index => $element) {
                if (is_array($element)) {
                    $this->xmlWriter->startElement($index);
                    $this->fromArray($element);
                    $this->xmlWriter->endElement();
                } else {
                    $this->xmlWriter->startElement($index);
                    $this->xmlWriter->text($element);
                    $this->xmlWriter->endElement();
                }
            }
        }
    }
746906
public function fromArray($array) {
		if (is_array($array) && sizeof($array)>0) {
			foreach ( $array as $value ) {
				if (is_array($value)) {
					$this->addImage($value ["src"], @$value ["alt"], @$value ["caption"], @$value ["description"]);
				} else {
					$this->addImage($value);
				}
			}
		}
		return $this;
	}
317744
public static function fromArray(array $file): self
    {
        $url = $file['file_ext'] === 'zip'
            ? $file['large_file_url']
            : $file['file_url'];

        return new self(
            $file['file_size'],
            $url,
            self::getFileTypeByExtension($file['file_ext']),
            $file['image_width'],
            $file['image_height']
        );
    }
981995
protected function doCreateObject(array $array)
    {
        $attribute = new Attribute(isset($array['attributes']) && is_array($array['attributes']) ? $array['attributes'] : $array);
        if (isset($array['attributeValues'])) {
            $mapper = new AttributeValuesMapper();
            foreach ($array['attributeValues'] as $item) {
                $attribute->values[] = $mapper->createObject($item);
            }
        }

        if (isset($array['attributeGroups'])) {
            $mapper           = new AttributeGroupsMapper();
            $attribute->group = $mapper->createObject($array['attributeGroups']);
        }


        return $attribute;
    }
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;
    }
61242
protected function createBuilder($array = [])
    {
        $builder = $this->model->newQuery();

        if ( ! empty($array)) {
            $builder->where($array);
        }

        if ( ! empty($this->scopes)) {
            foreach ($this->scopes as $scope => $args) {
                $builder->{$scope}($args);
            }
        }

        return $builder;
    }
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;
    }
338184
public static function fromArray(array $array)
    {
        $hostname       = $array['hostname'] ?? null;
        $challengeTs    = $array['challenge_ts'] ?? null;
        $apkPackageName = $array['apk_package_name'] ?? null;
        $score          = isset($array['score']) ? floatval($array['score']) : null;
        $action         = $array['action'] ?? null;

        if (isset($array['success']) && $array['success'] == true)
            return new static(true, [], $hostname, $challengeTs, $apkPackageName, $score, $action);

        if ( ! (isset($array['error-codes']) && is_array($array['error-codes'])))
            $array['error-codes'] = [ResponseV3::E_UNKNOWN_ERROR];

        return new static(false, $array['error-codes'], $hostname, $challengeTs, $apkPackageName, $score, $action);
    }
470933
public static function createFromArray(array $array): self
    {
        $activeElements = [];
        foreach (($array['active_elements'] ?? []) as $activeElement) {
            $activeElements[] = is_array($activeElement)
                ? Counter::createFromArray($activeElement)
                : $activeElement;
        }

        $aggregation = new self(
            $array['name'],
            (int) ($array['application_type'] ?? Filter::AT_LEAST_ONE),
            (int) ($array['total_elements'] ?? 0),
            []
        );
        $aggregation->activeElements = $activeElements;
        $counters = array_map(function (array $counter) {
            return Counter::createFromArray($counter);
        }, $array['counters'] ?? []);
        foreach ($counters as $counter) {
            $aggregation->counters[$counter->getId()] = $counter;
        }

        $aggregation->highestActiveLevel = $array['highest_active_level'] ?? 0;

        return $aggregation;
    }
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;
	}
679579
public function mergeRecursive($array)
    {
        if ($this->isInstanceOf($array, $this)) {
            $array = $array->val();
        }

        $this->val(array_merge_recursive($this->val(), $array));

        return $this;
    }