load data form php file or array
@param array|string $data
@return static
@throws \InvalidArgumentException
482792
public function loadArray($data)
    {
        if (\is_string($data) && is_file($data)) {
            $data = require $data;
        }

        if (!\is_array($data)) {
            throw new \InvalidArgumentException('param type error! must is array.');
        }

        return $this->bindData($this->data, $data);
    }
121489
public static function fromData(array $data)
    {
        $class = get_called_class();
        $isDynamic = is_a($class, DynamicEntity::class, true);

        /** @var static $entity */
        $entity = (new \ReflectionClass($class))->newInstanceWithoutConstructor();

        object_set_properties($entity, $data, $isDynamic);

        if (method_exists($entity, '__construct')) {
            $entity->__construct();
        }

        $entity->markNew(false);

        return $entity;
    }
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;
    }
600724
private function load($data)
    {
        if (empty($data)) {
            throw new DataSift_Exception_InvalidData('No data found');
        }

        //Assign the instance variables
        foreach ($data as $key => $value) {
            $this->{'_' . $key} = $value;
        }
    }
935137
public function data(array $data)
    {
        $this->columns(array_keys($data))->values(array_values($data));

        return $this;
    }
303013
public function make($data)
    {
        if ($data instanceof Collection) {
            $this->data = collect($data->toArray());
        } elseif (is_array($data)) {
            $this->data = collect($data);
        } else {
            throw new InvalidArgumentException('Invalid data type.');
        }

        $this->config = Config::get('nestable');

        $this->parent = $this->config['parent'];

        $this->primary_key = $this->config['primary_key'];

        return $this;
    }
273662
public function setData($data)
    {
        if ( ! (is_array($data) || $data instanceof Traversable)) {
            throw new InvalidArgumentException(
                sprintf(
                    '%s expects an array or Traversable collection; invalid collection of type %s provided',
                    __METHOD__,
                    is_object($data) ? get_class($data) : gettype($data)
                )
            );
        }

        // https://github.com/zendframework/zend-inputfilter/pull/169
        $this->collectionRawValues = $data;

        foreach ($data as $item) {
            if (is_array($item) || $item instanceof Traversable) {
                continue;
            }

            throw new InvalidArgumentException(
                sprintf(
                    '%s expects each item in a collection to be an array or Traversable; '
                    . 'invalid item in collection of type %s detected',
                    __METHOD__,
                    is_object($item) ? get_class($item) : gettype($item)
                )
            );
        }

        $this->data = $data;
        return $this;
    }
1046281
public function setData($data)
    {
        $this->data = $data;

        if (is_string($this->data)) {
            $this->data = json_decode($this->data, true);
        } else if (is_object($data)) {
            $this->data = json_decode(json_encode($this->data), true);
        } else if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf('Invalid data type in JsonStore. Expected object, array or string, got %s', gettype($data)));
        }
    }
1222115
public function setData($data = [])
    {
        try {
            $data = json_encode($data, $this->encodingOptions);
        } catch (\Exception $e) {
            if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
                throw $e->getPrevious() ?: $e;
            }
            throw $e;
        }

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \InvalidArgumentException(json_last_error_msg());
        }

        return $this->setJson($data);
    }
694610
public function setData($data) 
	{
		if(is_array($data)) {
			$this->data = $data;
		}
		
		$args = func_get_args();
		$this->data[$args[0]] = $args[1];
		
		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
		);
	}
783856
public function data(array $data = null)
    {
        if (is_null($data)) {
            return $this->data;
        }

        $this->data = $data;

        return $this;
    }
105281
public function setData($data = array())
    {
        // Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
        $this->data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \InvalidArgumentException($this->transformJsonError());
        }

        return $this->update();
    }
593848
public static function normalizeArray($data)
    {
        if ($data instanceof DataObjectInterface) {
            $data = $data->getData();
        } else if ($data instanceof \ArrayObject) {
            $data = $data->getArrayCopy();
        } else if ($data instanceof \Traversable) {
            $data = iterator_to_array($data);
        }

        if (!is_array($data)) throw new \InvalidArgumentException();

        return $data;
    }
1212522
private function loadModule(array $data)
    {
        $module = null;
        try {
            $module = $this->createFromArray($data);
        } catch (\common_exception_InconsistentData $dataException) {
            \common_Logger::w('Got inconsistent module data, skipping.');
        }
        return $module;
    }
327640
protected function formatMessage(array $data = [])
    {
        $params = array_merge($this->message, $data);

        foreach ($params as $key => $value) {
            if (in_array($key, $this->required, true) && empty($value) && empty($this->message[$key])) {
                throw new InvalidArgumentException(sprintf('Attribute "%s" can not be empty!', $key));
            }

            $params[$key] = empty($value) ? $this->message[$key] : $value;
        }

        $params['data'] = $this->formatData($params['data'] ?? []);

        return $params;
    }
307083
public function render(array $data = [])
	{
		if ( ! empty($data))
		{
			$this->set($data);
		}

		return $this->parser->parse($this->file, $this->getData());
	}