Sets an option.

@param string $key   The key
@param mixed  $value The value

@throws \InvalidArgumentException
514824
public function setOption($key, $value)
    {
        if (!\array_key_exists($key, $this->options)) {
            throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key));
        }

        $this->checkDeprecatedOption($key);

        $this->options[$key] = $value;
    }
238839
public function set($key, $value)
    {
        if($this->validate($key, $value)) {
            $this->options[$key] = $value;
        }
    }
151873
public function set($key, $value)
	{
		if ( ! $value instanceof Checkbox)
		{
			throw new \InvalidArgumentException('Only Checkboxs can be added to a CheckboxGroup');
		}

		return parent::set($key, $value);
	}
1170627
public function set($key, $value)
    {
        if (!is_scalar($value) && !is_array($value)) {
            $msg = 'Value has to be a scalar or an array, but is '.gettype($value).'.';
            throw new InvalidArgumentException($msg);
        }

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

        return $this;
    }
1081692
public function set($key, $value)
    {
        $method = 'setter' . ucfirst($key);
        if (method_exists($this, $method)) {
            $value = $this->$method($value);
        }
        $this->setRaw($key, $value);
    }
1338788
public function setValue($value) {
		if(!in_array($value, self::VALID_VALUES)) {
			throw new InvalidArgumentException('Value is not valid.');
		}

		$this->value = $value;

		return $this;
	}
923466
public function setOption($key, $value=null)
	{
	    if (is_array($key)) {
	        foreach ($key as $k => $v) {
	            $this->setOption($k, $v);
	        }
	    } else {
	        $this->options[$key] = $value;
	    }
	}
946872
public function setOption($key, $value): void
    {
        $method = 'set' . Str::toCamelCase($key);
        if (method_exists($this, $method)) {
            $this->$method($value);
        } else {
            $this->options[$key] = $value;
        }
    }
164125
public function offsetSet($key, $value)
	{
		if (!is_scalar($key)) { // prevents NULL
			throw new InvalidArgumentException("Key must be either a string or an integer, " . gettype($key) ." given.");
		}
		$this->$key = $value;
	}
1183006
protected function setValue($value)
    {
        if (!$this->validate($value)) {
            throw new \InvalidArgumentException(sprintf('%s is not a valid value', $value));
        }

        $this->value = $value;
    }
748910
public function offsetSet($key, $value)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException('The name of the macro must be a string.');
        }

        if (!is_callable($value)) {
            throw new InvalidArgumentException('The macro must be a callable value.');
        }

        $this->macros[$key] = $value;
    }
423761
protected function setValue($value)
    {
        if (is_string($value)) {
            $this->value = $value;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($value). "' for argument 'value' given."
            );
        }

        return $this;
    }
550071
public function setParam($key, $value = null)
    {
        if (!$this->hasParam($key)) {
            throw new \InvalidArgumentException(sprintf('Cannot set %s as parameter cause this key does not exist.', $key));
        }

        if (is_object($value)) {
            throw new \InvalidArgumentException('Parameter\'s value cannot be type of object.');
        }

        $currentValue = $this->getParamValue($key);
        if (
            (null !== $value && null !== $currentValue)
            && (
                gettype($value) !== gettype($currentValue)
                && (
                    !(is_string($value) || is_integer($value))
                    || !(is_string($currentValue) || is_integer($currentValue))
                )
            )
        ) {
            throw new \InvalidArgumentException(sprintf(
                'Cannot replace %s\'s value, %s expected and %s given.',
                $key,
                gettype($currentValue),
                gettype($value)
            ));
        }

        if (null === $value) {
            unset($this->_parameters[$key]);
        } else {
            $this->_parameters[$key] = ['value' => $value];
        }

        return $this->getContentInstance();
    }
918027
protected function setKey($key, $value)
    {
        if ($key == $this->_keyName) {
            $this->_keyValue = $value;
            $this->_key['value'] = $value;
        }
    }
608710
public function set(string $key, $value)
    {
        $value = static::format($value);
        parent::set($key, $value);
    }
1309924
public function setOption($key, $value)
    {
        if ($key == 'tag') {
            $this->tag = $value;
        } else {
            $this->attributes[$key] = $value;
        }
        return true;
    }
1285591
public function set($key, $value)
    {
        if (!$key) {
            throw new \InvalidArgumentException('Missing Key in Session Set Method');
        }
        $this->sessionData[$key] = $value;

        return $this;
    }