Import from array

@param array $data
@return $this
177466
public function import(array $data)
    {
        if (count($data) !== 4) {
            throw new \InvalidArgumentException("Invalid footprint array");
        }

        $this->_type = $data[0];
        $this->_constants = $data[1];
        $this->_interfaces = $data[2];
        $this->_parent = $data[3];

        return $this;
    }
1216289
public function fromArray($data)
    {
        if (empty($data)) {
            return $this;
        }
        if (isset($data['type']) && $data['type']) {
            $this->setType($data['type']);
        }
        if (isset($data[$this->getType()]) && $data[$this->getType()]) {
            $this->setValue($data[$this->getType()]);
        }
        return $this;
    }
139619
public function add_data(array $data)
	{
		$ar = \func_get_args();
		foreach ( $ar as $d ){
			if ( \is_array($d) ){
				$this->data = $this->has_data() ? array_merge($this->data,$d) : $d;
			}
		}
		return $this;
	}
206343
public function initFromArray(array $data) {

        $this->traitInitFromArray($data);

        if (!empty($data['details'])) {
            $this->setDetails((new LedgerDetailsPart())->initFromArray($data['details']));
        }

        return $this;

    }
1087373
public static function fromArray(array $data)
    {
        return new static(
            $data['uri'],
            $data['title'],
            $data['date'],
            $data['type'],
            $data['content'],
            isset($data['template']) ? $data['template'] : null,
            isset($data['description']) ? $data['description'] : null,
            isset($data['seoTitle']) ? $data['seoTitle'] : null,
            isset($data['excerpt']) ? $data['excerpt'] : null,
            isset($data['isIndex']) ? $data['isIndex'] : false
        );
    }
895807
public final function load(array $data): self
    {
        foreach ($data as $key => $value) {
            $this->set($key, $value);
        }

        return $this;
    }
69081
public static function createFromArray(array $data)
    {
        $self = new self();

        foreach ($data as $translation) {
            $self->addTranslation(Translation::createFromArray($translation));
        }

        return $self;
    }
865927
public function add(array $data): Insert
    {
        if (!isset($data[0]) && count($this->fields) == 0) {
            $this->fields(array_keys($data));
        }

        $this->data[] = $data;
        return $this;
    }
132967
public function bind(array $data)
	{
		if (null === $this->object)
		{
			$this->object = new Object;
		}

		$this->object->bind($data);

		return $this;
	}
34041
private function import(&$data)
    {
        $imports = array();
        preg_match_all('/#@([-a-z0-9\/_]+)\\n/is', $data, $imports, PREG_SET_ORDER);
        foreach ($imports as $import) {
            $importPath = FS2LANG . '/' . $this->local . '/' . $import[1] . '.txt';
            $importData = @file_get_contents($importPath);

            // getting file content ok
            if ($importData != false) {
                $importData = str_replace(array("\r\n", "\r"), "\n", $importData); // unify linebreaks
                $this->import($importData);
                $replace = '/#@' . preg_quote($import[1], '/') . '/i';
                $data = preg_replace($replace, $importData, $data);
                // replace all imports recursive
            }
        }
        unset($imports);
    }
837646
public function fromArray($data)
    {
        foreach ($data as $key => $value) {
            if (is_int($key) || $this->isFillable($key)) {
                $this->set($key, $value);
            }
        }
        return $this;
    }
1008998
public function setColumns(array $data)
    {
        unset($this->query['columns']);
        foreach ($data as $field => $value) {
            $this->addColumn($field, $value);
        }
        return $this;
    }
1017963
public static function fromArray(array $data)
	{
		return new self(
			!empty($data['code'])    ? $data['code']    : null,
			!empty($data['message']) ? $data['message'] : null,
			!empty($data['data'])    ? $data['data']    : null
		);
	}
271337
public function set(array $data)
    {
        foreach ($data as $key => $value) {
            if (method_exists($this, 'set' . $key)) {
                $this->{'set' . $key}($value);
            }
        }

        return $this;
    }
138067
public function initFromArray(array $data) {

        $this->traitInitFromArray($data);

        if (!empty($data['total'])) {
            $this->setTotal((new LimitAmount())->initFromArray($data['total']));
        }

        if (!empty($data['remaining'])) {
            $this->setRemaining((new LimitAmount())->initFromArray($data['remaining']));
        }

        return $this;

    }
307014
public function setData(array $data)
    {
        $this->data = $this->parseData($data);

        $this->setRules($this->initialRules);

        return $this;
    }
520893
public function setData(array $data)
    {
        foreach ($this->getData()->toArray() as $key => $value) {
            $this->getData()->offsetUnset($key);
        }

        $this->addData($data);

        return $this;
    }