Set custom value for Payload.

@param string $key
@param mixed $value
@return Payload
@throws InvalidPayloadException
337331
public function setCustomValue(string $key, $value): Payload
    {
        if ($key === self::PAYLOAD_ROOT_KEY) {
            throw InvalidPayloadException::reservedKey();
        }

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

        return $this;
    }
24458
public function set($key, $value)
    {
        if (! $value instanceof EmitterInterface) {
            throw new InvalidArgumentException(
                "Only EmitterInterface object can be putted in a ".
                "EmittersMap."
            );
        }
        return parent::set($key, $value);
    }
782376
public function set($key, $value)
    {
        if (!$value instanceof EmailBodyPart) {
            throw new InvalidArgumentException(
                sprintf(
                    '%s only accepts instances of %s. Tried to to set key %s.',
                    __FUNCTION__, EmailBodyPart::class, $key
                )
            );
        }

        parent::set($key, $value);
    }
923563
public function setPost($key, $value = null)
    {
        if (is_array($key)) {
            $_POST = $key;
        } else {
            $_POST[$key] = $value;
        }
        return $this;
    }
429846
public function set($key, $value = null)
    {
        if( is_array($key) ) {
            $this->values($key);
        } else {
            $this->value($key, $value);
        }
        return $this;
    }
139565
public function setValue($value)
    {
        if (null !== $value) {
            if (!$this->validateValue($value)) {
                throw new \InvalidArgumentException(\sprintf(
                    'Binding invalid value (type "%s") into filter "%s" (%s)',
                    \is_object($value) ? \get_class($value) : \gettype($value),
                    $this->name,
                    \get_class($this)
                ));
            }

            $this->value = $value;
            $this->updateBound();
        }

        return $this;
    }
570120
public function set($key, $value)
    {
        if (is_array($key) && $value === null)
            $args = $key;
        else
            $args = func_get_args();

        $path = $args;
        $value = array_pop($path);
        $type = $this->types->dget($path);
        $kpath = implode('.', $path);

        // Key is undefined, but it may be in a untyped sub-array
        if ($type === null)
        {
            $cpy = $path;
            while (count($cpy))
            {
                $last = array_pop($cpy);
                $subtype = $this->types->dget($cpy);
                if ($subtype instanceof Validator && $subtype->getType() === Type::ARRAY)
                    return parent::set($args, null);
            }
        }

        if ($type === null)
            throw new \InvalidArgumentException("Undefined key: " . $kpath);

        if ($type instanceof Dictionary)
        {
            // Subfiltering required - extract values
            if (!Functions::is_array_like($value))
                throw new \InvalidArgumentException("Value must be array at: " . $kpath);

            foreach ($value as $subkey => $subval)
            {
                $nargs = $path;
                $nargs[] = $subkey;
                $nargs[] = $subval;
                $this->set($nargs, null);
            }
            return;
        }

        if (!$type->validate($value))
        {
            $error = $type->getErrorMessage($value);
            $msg = WF::fillPlaceholders($error['msg'], $error['context'] ?? []);
            throw new \InvalidArgumentException($msg);
        }

        return parent::set($args, null);
    }
295198
public function set($key, $value)
    {
        if (! is_scalar($key)) {
            throw InvalidArgumentException('Invalid key type');
        }
        $this->items[$this->normalizeKey($key)] = $value;
    }
488761
public function addData($key, $value)
    {
        if (!is_string($key) && !is_int($key)) {
            throw new \InvalidArgumentException('Data keys must be of type "string" or "integer".');
        }

        $data = $this->getData();

        $data[$key] = $value;

        return $this->setData($data);
    }
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);
	}
154097
function setServerTag($key, $value, $multicall = false)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException('key = ' . print_r($key, true));
        }
        if (!is_string($value)) {
            throw new InvalidArgumentException('value = ' . print_r($value, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($key, $value), $multicall);
    }
127124
public function set($key, $value)
    {
        if (!is_string($key)) {
            throw new \InvalidArgumentException('$key must be string');
        }

        if (!is_string($value) && !is_numeric($value) && !is_bool($value)) {
            throw new \InvalidArgumentException('$value must be string, int or bool');
        }

        $this->annotations[] = [
            'key' => $key,
            'value' => (string) $value
        ];
    }
1262954
public static function set(string $key, $value)
    {
        if (!in_array($key, self::$allowedKeys)) {
            throw new \InvalidArgumentException('Invalid key given');
        }

        self::$storedValues[$key] = $value;
    }
1256579
function set($key, $value) {
        parent::set($key, $value);
        if($this !== $this->client->emojis) {
            $this->client->emojis->set($key, $value);
        }
        
        return $this;
    }
1081731
public static function set(string $key, $value)
    {
        file_put_contents(self::determineDabaseFilePathFor($key), Json::encode($value));

        return $value;
    }
212341
function set($key, $value)
    {
        $p = &$this->__attainInternalPointer();
        $p[$key] = $value;
        return $this;
    }
55070
public function set ($path, $value) {
		list ($first, $rest) = self::getFirstAndRestPathElements($path);

		# If we are going still deeper...
		if (!is_null($rest)) {
			if (!array_key_exists($first, $this -> data)) {
				$this -> applyValue($first, array());
			} else if (!($this -> data[$first] instanceof MutableTreeInterface)) {
				throw new InvalidKeyException("Value at key `" . $first . "` is a scalar; cannot step further down the requested path `" . $rest . "`");
			}

			/** @var MutableTreeInterface $tree */
			$tree = $this -> data[$first];

			$tree -> set($rest, $value);
		} else {
			$this -> applyValue($first, $value);
		}

		return $this;
	}