Set a new value for the given key.

@param string $key

@throws \InvalidArgumentException when the value is not scalar or null
@throws \RuntimeException         when the key does not exist, it is not editable, or some unknown reason
431066
public static function set($key, $value): void
    {
        Assert::nullOrScalar($value, 'ini values must be scalar or null. Got: %s');

        $iniValue = $value === false ? '0' : (string) $value;

        $result = false;
        $ex = null;
        try {
            $result = Thrower::call('ini_set', $key, $iniValue);
        } catch (\Throwable $ex) {
        }

        if ($result === false || $ex !== null) {
            if (! static::has($key)) {
                throw new \RuntimeException(
                    "The ini option '${key}' does not exist. New ini options cannot be added.",
                    0,
                    $ex
                );
            }
            if (! static::$keys[$key]) {
                throw new \RuntimeException(
                    "Unable to change ini option '${key}', because it is not editable at runtime.",
                    0,
                    $ex
                );
            }

            $value = Assert::valueToString($value);
            throw new \RuntimeException(sprintf('Unable to change ini option "%s" to %s.', $key, $value), 0, $ex);
        }

        // HHVM sets values w/o error, but the change is not actually applied.
        if (ini_get($key) !== $iniValue) {
            $value = Assert::valueToString($value);
            throw new \RuntimeException(sprintf('Unable to change ini option "%s" to %s.', $key, $value), 0, $ex);
        }
    }
344258
public function set(string $key, $value)
    {
        $array = &$this->input;
        $keys = explode('.', $key);

        while (count($keys) > 1) {
            $k = array_shift($keys);
            if (!isset($array[$k]) || ! is_array($array[$k])) {
                $array[$k] = [];
            }
            $array = &$array[$k];
        }

        $array[array_shift($keys)] = $value;
        $this->cache[$key] = &$value;
    }
1162148
public function set($key, $value)
    {
        $this->nestedKeyCache = [];

        if ($this->isNestedKey($key)) {
            $this->setNestedValueByKey($key, $value);

            return;
        }

        $this->items[$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;
	}
208850
protected function setParameter($key, $value)
    {
        if (null !== $this->response) {
            throw new RuntimeException('Request cannot be modified after it has been sent!');
        }
        $this->parameters->set($key, $value);

        return $this;
    }
20103
public function delete($key)
	{
		if ($this->readOnly)
		{
			throw new \RuntimeException('Changing values on this Data Container is not allowed.');
		}

		$this->isModified = true;

		if (($result = Arr::delete($this->data, $key)) === false and $this->parentEnabled)
		{
			$result = $this->parent->delete($key);
		}

		return $result;
	}
239644
public function setKey($key)
    {
        $this->key = $key;
        $this->driver->setNamespace($this->key);
    }
702146
public function set($key, $value) {
		$this->validateValue($value);
		$this->variables[$key] = $value;
	}
1030155
public function setKey($key)
    {
        $this->hash = null;

        if (empty($key)) {
            $this->key = null;
            return;
        }

        $this->key = (string) $key;
        $this->hash = $this->makeHash($key);
    }
705711
private function setInitValue($key, $value)
    {
        if ($this->serviceDescription !== null) {
            throw new \RuntimeException('Too late to set "'.$key.'"');
        }
        $this->init[$key] = $value;

        return $this;
    }
559866
protected function setKey($key, $value)
    {
        $key = strtolower((string)$key);
        $this->keys[$key] = (string)$value;
    }
319406
public function setUniqueKey($uniqueKey)
    {
        if (! is_null($this->uniqueKey)) {
            throw new RuntimeException('The unique key was already set.');
        }
        if (! is_int($uniqueKey) && ! is_string($uniqueKey)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid type of specified unique key; must be an integer or '
                . 'an string, "%s" received.',
                gettype($uniqueKey)
            ));
        }
        $this->uniqueKey = $uniqueKey;
    }
67308
protected function setKey($key)
    {
        // If a handler switches key, we need to decrement the counter for the old
        // key, and increment the counter for the new key.
        $this->removeKey();

        // Set the new key, and increment the counter appropriately.
        $this->key = $key;
        if (isset($key)) {
            static::$keys[$key] = isset(static::$keys[$key]) ? static::$keys[$key] + 1 : 1;
        }
    }
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;
    }
252432
final public static function set($key, $value)
	{
		self::_checkInstance();
		self::$_instance->offsetSet($key, $value);
	}
624160
protected function setFieldOriginalValue($key)
    {
        $values = [];
        if (array_key_exists($key, $this->original)) {
            $values = $this->original[$key];
        }

        $this->fields->each(function (Field $field) use ($values) {
            $field->setOriginal($values);
        });
    }
207974
public function set($key, $value)
	{
		if ($this->readOnly)
		{
			throw new \RuntimeException('Changing values on this Data Container is not allowed.');
		}

		$this->isModified = true;

		if ($key === null)
		{
			$this->data[] = $value;

			return $this;
		}

		Arr::set($this->data, $key, $value);

		return $this;
	}