Set property value in attributes.

@param  string $key
@param  mixed  $property
@param  mixed  $value
@return mixed
486404
protected function setProperty($key, $property, $value = null)
    {
        // Can't be changed
        if ($key[0] === '@') {
            return $this->properties[$key] = $property;
        }

        // If the attribute has a get mutator, we will call that
        // then return what it returns as the value.
        if ($this->hasGetMutator($key)) {
            return $this->properties[$key] = $this->mutateAttribute($key, $value);
        }

        // Format date and time to UTC
        if ($value instanceof DateTime) {
            return $this->properties[$key] = $value->format('Y-m-d\TH:i:s');
        }

        // Set nested context
        if ($value instanceof Context) {
            return $this->properties[$key] = $this->filterNestedContext($value->getProperties());
        }

        // Set nested context from class
        if ($property && class_exists($property)) {
            return $this->properties[$key] = $this->getNestedContext($property, $value);
        }

        // Map properties to object
        if ($property !== null && is_array($property) && is_array($value)) {
            return $this->properties[$key] = $this->mapProperty($property, $value);
        }

        // Set value
        return $this->properties[$key] = $value;
    }
1117248
public function setScriptAttribute(string $key, string $value)
    {
        $this->scriptAttributes[$key] = $value;

        return $this;
    }
418009
public function put($key, $value = '')
    {
        Arr::set($this->attributes, $key, $value);

        return $this;
    }
1212629
public function set($key, $value)
    {
        if (!is_string($key)) {
            throw new ClientException('Invalid attribute key');
        }

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

        return $this;
    }
577221
public function set($property, $value = null)
        {
            $this->One->set($property, $value);

            return $this;
        }
347872
protected function setProperty($key, $value) {
        // convert string representations of special values
        if (is_string($value)) {
            switch (strtolower($value)) {
                case  'null' :
                case '(null)':
                    $value = null;
                    break;

                case  'true' :
                case '(true)':
                case  'on'   :
                case  'yes'  :
                    $value = true;
                    break;

                case  'false' :
                case '(false)':
                case  'off'   :
                case  'no'    :
                    $value = false;
                    break;

                default:
                    if (strIsQuoted($value)) {
                        $value = substr($value, 1, strlen($value)-2);
                    }
            }
        }

        // set the property depending on the existing data structure
        $properties  = &$this->properties;
        $subkeys     =  $this->parseSubkeys(strtolower($key));
        $subkeysSize =  sizeof($subkeys);

        for ($i=0; $i < $subkeysSize; ++$i) {
            $subkey = trim($subkeys[$i]);
            if (!strlen($subkey)) throw new InvalidArgumentException('Invalid argument $key: '.$key);

            if ($i+1 < $subkeysSize) {
                // not yet the last subkey
                if (!key_exists($subkey, $properties)) {
                    $properties[$subkey] = [];                              // create another array level
                }
                elseif (!is_array($properties[$subkey])) {
                    $properties[$subkey] = ['' => $properties[$subkey]];    // create another array level and keep the
                }                                                           // existing non-array value
                $properties = &$properties[$subkey];                        // reference the new array level
            }
            else {
                // the last subkey: check for bracket notation
                if (preg_match('/(.+)\b *\[ *\]$/', $subkey, $match)) {
                    // bracket notation
                    $subkey = $match[1];
                    if (!key_exists($subkey, $properties)) {
                        $properties[$subkey] = [$value];                    // create a new array value
                    }
                    else {
                        if (!is_array($properties[$subkey]))                // make the existing value the array root value
                            $properties[$subkey] = ['' => $properties[$subkey]];
                        $properties[$subkey][] = $value;                    // add an array value
                    }
                }
                else {
                    // regular non-bracket notation
                    if (!key_exists($subkey, $properties)) {
                        $properties[$subkey] = $value;                      // store the value regularily
                    }
                    else if (!is_array($properties[$subkey])) {
                        $properties[$subkey] = $value;                      // override the existing value
                    }

                    // modification of an array value
                    else if ($value === null) {
                        $properties[$subkey] = $value;                      // set the array to NULL, don't remove the key
                    }
                    else if (is_array($value)) {
                        $properties[$subkey] = $value;                      // replace the array
                    }
                    else {
                        $properties[$subkey][''] = $value;                  // set/override the array root value
                    }
                }
            }
        }

        // TODO: update the cache if the instance is a cached instance
    }
871332
public function setAttribute($key, $value)
    {
        // check if it's a enum
        if (isset($this->enums[$key]) && is_scalar($value)) {
            $enumClass = $this->enums[$key];
            $this->attributes[$key] = new $enumClass($value);
        } else {
            parent::setAttribute($key, $value);
        }
        return $this;
    }
1176206
public function setProperty($property, $value)
    {
        if (property_exists($this, $property) && $property !== 'form') {
            $this->$property = $value;
        }
        return $this;
    }
1121922
public function setAttribute($key, $value)
    {
        // First we will check for the presence of a mutator for the set operation
        // which simply lets the developers tweak the attribute as it is set on
        // the model, such as "json_encoding" an listing of data for storage.
        if ($this->hasSetMutator($key)) {
            $method = 'set' . Str::studly($key) . 'Attribute';

            return $this->{$method}($value);
        }

        // If an attribute is listed as a "date", we'll convert it from a DateTime
        // instance into a form proper for storage on the database tables using
        // the connection grammar's date format. We will auto set the values.
        if ($value && $this->isDateAttribute($key)) {
            $value = $this->fromDateTime($value);
        }

        if ($this->isJsonCastable($key) && !is_null($value)) {
            $value = $this->asJson($value);
        }

        // If this attribute contains a JSON ->, we'll set the proper value in the
        // attribute's underlying array. This takes care of properly nesting an
        // attribute in the array's value in the case of deeply nested items.
        if (Str::contains($key, '->')) {
            return $this->fillJsonAttribute($key, $value);
        }

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

        return $this;
    }
799293
public function setAttribute($key, $value)
    {
        // First we will check for the presence of a mutator for the set operation
        // which simply lets the developers tweak the attribute as it is set on
        // the model, such as "json_encoding" an listing of data for storage.
        if ($this->hasSetMutator($key)) {
            return $this->setMutatedAttributeValue($key, $value);
        }

        // If an attribute is listed as a "date", we'll convert it from a DateTime
        // instance into a form proper for storage on the database tables using
        // the connection grammar's date format. We will auto set the values.
        elseif ($value && $this->isDateAttribute($key)) {
            $value = $this->fromDateTime($value);
        }

        if ($this->isJsonCastable($key) && ! is_null($value)) {
            $value = $this->castAttributeAsJson($key, $value);
        }

        // If this attribute contains a JSON ->, we'll set the proper value in the
        // attribute's underlying array. This takes care of properly nesting an
        // attribute in the array's value in the case of deeply nested items.
        if (Str::contains($key, '->')) {
            return $this->fillJsonAttribute($key, $value);
        }

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

        return $this;
    }
201804
public function setAttribute($key, $value)
    {
        // We will check for the presence of a mutator for the set operation
        // which simply lets the developers tweak the attribute as it is set on
        // the model, such as "json_encoding" an listing of data for storage.
        if ($this->hasSetMutator($key)) {
            $method = 'set'.studly_case($key).'Attribute';
            return $this->{$method}($value);
        }

        $this->attributes[$key] = $value;
    }
1110799
public function setAttribute(string $key, string $value)
    {
        if ($this->valid($key, $value)) {
            $value = encrypt($value);
        }

        return parent::setAttribute($key, $value);
    }
617764
public function set_attribute( $key, $value ) {
		$this->attributes[ $key ] = $this->sanitize_attribute( $key, $value );

		return $this;
	}
535559
public function set($property, $value)
    {
        if($property == 'module')
        {
            $value = clone $value;

            if(is_string($value->params)) {
                $value->params = $this->getObject('object.config.factory')->fromString('json', $value->params);
            }
        }

        parent::set($property, $value);
    }
2780
public function setAttribute($key, $value)
    {
        if ($value !== null && $this->hasEnumCast($key)) {
            $enum = $this->enumCasts[$key];

            if ($value instanceOf $enum) {
                $this->attributes[$key] = $value->value;
            } else {
                $this->attributes[$key] = $enum::getInstance($value)->value;
            }

            return $this;
        }

        parent::setAttribute($key, $value);
    }
378254
public function setAttribute($name, $value)
    {
        if ($this->propertyExists($name)) {
            $this->attributes[$name] = $value;
        } else {
            $this->setDirtyAttribute($name, $value);
        }
        return $this;
    }
383269
public function set($key, $value)
    {
        $cont = clone $this;
        $cont->setParameter($key, $value);

        return $cont;
    }