Add (or replace) an nested widget option.

@param  string $key The setting to add/replace.
@param  mixed  $val The setting's value to apply.
@throws InvalidArgumentException If the identifier is not a string.
@return self
484567
public function addWidgetData($key, $val)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException(
                'Setting key must be a string.'
            );
        }

        // Make sure default options are loaded.
        if ($this->widgetData === null) {
            $this->widgetData();
        }

        $this->widgetData[$key] = $val;

        return $this;
    }
187358
public final function set ($key, $val)
    {
        if (in_array($key, $this->getColumn())) {
            $this->record->{$key} = $val;
            return true;
        }

        return false;
    }
843927
public function set($key, $value)
	{
		if ( !($value instanceof Option) )
		{
			throw new InvalidArgumentException('Only Options can be added to an Optgroup.');
		}

		return parent::set($key, $value);
	}
944932
public function config($key, $val = null, $default = null)
    {
        if ($val == null) {
            return Config::get($key, $default);
        } else {
            Config::set($key, $val);
        }
    }
68588
function(key, val) {
      var len = arguments.length;
      if (len === 1 && typeof key === 'string') {
        return this.getOption(key);
      }
      if (utils.isObject(key)) {
        this.visit('option', key);
        return this;
      }
      set(this.options, key, val);
      this.emit('option', key, val);
      return this;
    }
610212
public function addMapOption($key, $val)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException(
                'Setting key must be a string.'
            );
        }

        // Make sure default options are loaded.
        if ($this->mapOptions === null) {
            $this->mapOptions();
        }

        $this->mapOptions[$key] = $val;

        if ($key === 'api_key') {
            $this->setApiKey($val);
        }

        return $this;
    }
396412
public function _setInit($key = null, $val = null)
    {
        if (is_null($key)) {
            $this->_init = array();
        } elseif (is_null($val)) {
            unset($this->_init[$key]);
        } else {
            switch ($key) {
            case 'capability':
                if ($ci = $this->getParam('capability_ignore')) {
                    $ignored = array();

                    foreach ($ci as $val2) {
                        $c = explode('=', $val2);

                        if ($val->query($c[0], isset($c[1]) ? $c[1] : null)) {
                            $ignored[] = $val2;
                            $val->remove($c[0], isset($c[1]) ? $c[1] : null);
                        }
                    }

                    if ($this->_debug->debug && !empty($ignored)) {
                        $this->_debug->info(sprintf(
                            'CONFIG: IGNORING these IMAP capabilities: %s',
                            implode(', ', $ignored)
                        ));
                    }
                }

                $val->attach($this);
                break;
            }

            /* Nothing has changed. */
            if (isset($this->_init[$key]) && ($this->_init[$key] === $val)) {
                return;
            }

            $this->_init[$key] = $val;
        }

        $this->changed = true;
    }
382038
protected function openTag($key, $val)
    {
        $exp = explode('_', $key);
        $this->openTagHolder = $exp[1];

        $extra = [
            'type' => $exp[0],
        ];

        return $this->composeElement($key, $val, $extra, true);
    }
268968
public function set($key,$val)
    {
        if (array_key_exists($key, $this->extras)) {
            $this->extras[$key] = $val;

            return $val;
        }

        return parent::set($key, $val);
    }
490767
protected function innerSet($key, $val)
    {
        $setMethod = 'set' . ucfirst($key);
        if ( !in_array($key, $this->notsetters()) && method_exists($this, $setMethod) ) {
            $this->$setMethod($val);
        } else {

            $validateMethod = 'validate' . ucfirst($key);

            if (method_exists($this, $validateMethod)) {

                $errors = new Exceptions();

                try {
                    $validateResult = $this->$validateMethod($val);
                    if (false === $validateResult) {
                        return;
                    }
                    if ($validateResult instanceof \Generator) {
                        foreach ($validateResult as $error) {
                            if ($error instanceof \Throwable) {
                                $errors->add($error);
                            }
                        }
                    }
                } catch (\Throwable $e) {
                    $errors->add($e);
                }

                if (!$errors->empty()) {
                    throw $errors;
                }

            }

            $sanitizeMethod = 'sanitize' . ucfirst($key);
            if (method_exists($this, $sanitizeMethod)) {
                $val = $this->$sanitizeMethod($val);
            }

            if (null === $key) {
                $this->__data[] = $val;
            } else {
                $this->__data[$key] = $val;
            }
        }
    }
515105
public function addSelectizeOption($key, $val)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException(
                'Setting key must be a string.'
            );
        }

        // Make sure default options are loaded.
        if ($this->selectizeOptions === null) {
            $this->selectizeOptions();
        }

        $this->selectizeOptions[$key] = $val;

        return $this;
    }
902271
public function addArgument(IStackableArgument $argument)
    {
        if ($argument instanceof ISubKeyedStackableArgument) {
            $key = $argument->getSubKey();
            if (isset($this->args[$key])) {
                throw new \InvalidArgumentException("Can't override the subkey: $key");
            }
        } else {
            $key = $this->stackKey();
        }

        $this->args[$key][$argument->getSubKey()] = $argument;

        return $this;
    }
402428
public function set(string $key, $val)
    {
        // set the variable
        if (empty($key)) {
            return $this;
        }

        $node = $this->mainNode->getLastByKey($key);

        if (!$node || !$node->getParent()) {
            $newNode = new Node($this->mainNode, $key, $val);
            $this->mainNode->addChild($newNode);
        } else {
            $newNode = new Node($node->getParent(), $key, $val);
            $node->getParent()->addChild($newNode);
        }

        $this->lastNewNode = $newNode;

        return $this;

    }
197853
public function add($key, $val) {
        if (!isset($this->_attrs[$key])) {
            $this->_attrs[$key] = [];
        }
        
        if (!strcasecmp($key, 'id')) {
            // value for `id` should be one only
            $this->_attrs[$key] = $val;
        } else {
            // else append it
            array_push($this->_attrs[$key], $val);
        }
        
        return $this;
    }
728885
public function setLngProperty($key)
    {
        if ($key === null) {
            $this->lngProperty = $key;
            return $this;
        }

        if (!is_string($key)) {
            throw new InvalidArgumentException(
                'The "lng_property" must be a string'
            );
        }

        $this->lngProperty = $key;
        return $this;
    }
226078
public function addElement($key, $val)
    {
        $this->myData = array_merge($this->myData, array((String)$key => $val));
    }
406038
public function addAttr($attr, $val)
    {
        if (is_string($attr) === false) {
            throw new \InvalidArgumentException;
        }

        $this->attributes[$attr] = $val;

        return $this;
    }