Set attributes of the model.

@param $attributes

@throws \Exception

@return $this
359708
public function _setAttributes($attributes)
    {
        if (is_array($attributes)) {
            foreach ($attributes as $attribute => $value) {
                $this->{$attribute} = $value;
            }

            return $this;
        }

        //@todo: put real exception here cos exception' gon be thrown either ways, so put one that makes sense
        //or something else that has more meaning
        throw new \InvalidArgumentException('Invalid argument Passed to set attributes on object');
    }
512571
public function syncOriginalAttributes($attributes)
    {
        $attributes = is_array($attributes) ? $attributes : func_get_args();

        foreach ($attributes as $attribute) {
            $this->original[$attribute] = $this->attributes[$attribute];
        }

        return $this;
    }
840895
public function setAttributes($attributes)
    {
        foreach ($attributes as $k => $val) {
            if ($this->isIgnoredAttribute($k)) {
                continue;
            }

            // this is for adding new class name with
            //   +=newClass
            if( is_string($val) && strpos($val ,'+=') !== false ) {

                
                $origValue = $this->getAttributeValue($k);
                if( is_string($origValue) ) {
                    $origValue .= ' ' . substr($val,2);
                } elseif ( is_array($origValue) ) {
                    $origValue[] = substr($val,2);
                } elseif ( is_object($origValue) ) {
                    throw new Exception('Invalid Object for attribute: ' . get_class($origValue) );
                } else {
                    throw new Exception('Unknown attribute value type.');
                }
                $this->setAttributeValue($k,$origValue);
            } else {
                $this->setAttributeValue($k, $val);
            }
        }
    }
617651
public function setAttribute($attribute, $value)
    {
        if(is_null($value)) {
            unset($this->attributes[$attribute]);
        }
        else {
            $this->attributes[$attribute] = $value;
        }

        return $this;
    }
81612
public function applyAttributes(array $attributes): ComponentInterface
    {
        if (count($attributes) > 0) {
            foreach ($attributes as $name => $value) {
                $this->setAttribute($name, $value);
            }
        }

        return $this;
    }
384069
public function setAttrs(array $attrs) {
		foreach ($attrs as $attr => $value) {
			$this->setAttr($attr, $value);
		}
		
		return $this;
	}
537209
public function attr(Array $attributes) : Table
    {
        foreach( $attributes as $att => $val )
        {
            $this->attr[$att] = $val;
        }

        return $this;
    }
231079
public function withAttributes(array $attributes): self
    {
        $result = clone $this;
        $result->attributes = new ParameterCollection($attributes);

        return $result;
    }
720627
public function setAttrArray(array $attributes)
    {
        foreach ($attributes as $attribute => $value) {
            $this->setAttr($attribute, $value);
        }
    }
1106645
public function setAttribute($attribute, $value)
    {
        Arr::set($this->attributes, $attribute, $value);

        return $this;
    }
691405
public function setAttributes($attributes = [])
    {
        if (empty($attributes) || !is_array($attributes)) {
            throw new DatabaseException(sprintf('Invalid argument passed to %s', __FUNCTION__));
        }

        foreach ($attributes as $key => $value) {
            $this->__set($key, $value);
        }
    }
878133
public function setAttributes(array $attributes)
    {
        $flattened = array_dot($attributes);

        $fields = $this->getFields();
        if (empty($fields))
            $fields = array_keys($attributes);

        foreach ($fields as $field) : 

            // make sure we have an aliased fields list
            $fillableKeys   = array_keys($this->fillable);
            $aliasedFields  = !empty($fillableKeys) && !is_integer($fillableKeys[0]);

            // read full path to attribute (get dot notation if available).
            $attribFullPath = isset($this->fillable[$field]) ? $this->fillable[$field] : $field;

            $hasByPath  = array_has($flattened, $attribFullPath);
            $hasByAlias = array_has($attributes, $field);

            if (! $hasByPath && ! $hasByAlias) {
                // try deep find and continue

                // browse attributes array in depth.
                $attrib = $attributes;
                foreach (explode(".", $attribFullPath) as $key) {
                    if (! isset($attrib[$key]))
                        $attrib[$key] = null;

                    $attrib = $attrib[$key];
                }

                $this->setAttribute($field, $attrib);
                continue;
            }

            // use attribute path or alias
            $attribValue = $hasByPath ? array_get($flattened, $attribFullPath)
                                      : array_get($attributes, $field);

            $this->setAttribute($field, $attribValue);
        endforeach ;

        return $this;
    }
1312342
public function withAttributes(array $attributes)
    {
        $this->attributes = $this->immutable + $attributes + $this->attributes;

        return $this;
    }
424218
public function setAttributeArray(array $attributes = null)
    {
        if (!is_array($attributes) || empty($attributes)) {
            return;
        }

        foreach ($attributes as $name => $value) {
            $this->setAttribute($name, $value);
        }
    }
416951
public function set($attribute, $value)
    {
        if (!$this->isImplemented($attribute)) {
            throw new Exception("PDO parameter not implemented - {$attribute}");
        }

        if ($this->hasValidator($attribute)) {
            $validator = $this->getValidator($attribute);
            $value = $this->{$validator}($value);
        }

        $this->attributes[$attribute] = $value;

        return $this;
    }
542741
public function setAttributes($attributes) {
		if (is_array($attributes) && empty($attributes)) {
			$this->attributes = new \stdClass;
		} else {
			$this->attributes = $attributes;
		}

		return $this;
	}
120600
public function setAttributes(array $attr)
    {
        foreach ($attr as $key => $value) {
            $this->setAttribute($key, $value);
        }

        return $this;
    }