Add an element with the passed values.

@param string $key    The key to add.
@param array  $values The values to use.

@return void

@throws \InvalidArgumentException When the passed array is invalid.
326872
protected function addItem(string $key, array $values): void
    {
        if (!array_key_exists('source', $values) || !array_key_exists('target', $values)) {
            throw new \InvalidArgumentException('Invalid translation array: ' . var_export($values, true));
        }

        $this->translationBuffer[$key] = new MemoryTranslationValue($key, $values['source'], $values['target']);
    }
689408
public function addData($key, $value = null)
    {
        if (is_array($key)) {
            foreach ($key as $k => $v) {
                $this->data[$k] = $v;
            }
        }
        else if (is_string($key)) {
            $this->data[$key] = $value;
        }
        else {
            throw new \InvalidArgumentException(
                "invalid value provided for 'key'; expecting a key as a ".
                "string or an associative array"
            );
        }
        return $this;
    }
841797
public function add($key, $value)
    {
        if (! isset($this->_params[$key])) {
            $this->_params[$key] = array();
        }
        $this->_params[$key][] = $value;
    }
940295
public function put( $key, $value = null ) {
		if ( ! is_array( $key ) ) {
			$key = [ $key => $value ];
		}

		foreach ( $key as $array_key => $array_value ) {
			Arr::set( $this->attributes, $array_key, $array_value );
		}
	}
355660
public function addKeys( $keys )
	{
		if( !is_array( $keys ) )
			throw new InvalidArgumentException( 'An Array should be given.' );
		foreach( $keys as $key )
			$this->addKey( $key );
	}
444882
public function addContext($key, $properties)
    {
        if (isset($this->context[$key]) && is_array($this->context[$key])) {
            $this->context[$key] = array_merge($this->context[$key], $properties);
        } else {
            $this->context[$key] = $properties;
        }
    }
762088
public function addExtraKeys(array $values)
    {
        foreach ($values as $key => $value) {
            $this->setExtraKey($key, $value);
        }
    }
613532
public function replace($key, $values)
    {
        $this->values[$key] = new SortedSet($values);
        $this->stateChanged();
    }
475984
public function addValue($key, array $values, string $table)
    {
        $this->checkTable($table);
        $redisKey = $this->getKey($key, $table);

        $this->redis->pipeline(function (Pipeline $pipe) use ($redisKey, $values) {
            foreach ($values as $value) {
                $pipe->sadd($redisKey, $value);
            }
        });

        return $this;
    }
604763
public function addAttribute($key, $value)
    {
        if (!$this->attributes) {
            $this->attributes = new Attributes();
        }

        $this->attributes[$key] = $value;
    }
277977
public function add($key, $value)
    {
        if (is_numeric($key)) {
            throw new \InvalidArgumentException('Key must not be a number.');
        }

        $this->data[$key] = $value;
    }
710171
public function addValues(array $values)
    {
        foreach ($values as $key => $value) {
            $this->addValue($key, $value);
        }
        return $this;
    }
1369262
public static function addValue(array &$arr, $key, $value)
    {
        if (isset($arr[$key])) {
            if (!is_array($arr[$key])) {
                $arr[$key] = [$arr[$key]];
            }
            $arr[$key][] = $value;
        }
        else {
            $arr[$key] = $value;
        }
    }
398047
public function add($key)
    {
        if (is_null($key)) {
            throw new InvalidArgumentException("Can't add NULL {$this->name}.");
        }

        if ($key instanceof Eloquent) {
            $key = $key->getAttribute('name');
        }

        if ($this->has($key)) {
            return false;
        }

        array_push($this->items, $this->getSlugFromName($key));

        return true;
    }
1320297
public function put($key, $value = null)
    {
        if (! is_array($key)) {
            $key = [$key => $value];
        }

        foreach ($key as $arrayKey => $arrayValue) {
            Arr::set($this->attributes, $arrayKey, $arrayValue);
        }
    }
880997
public function add($key, $val)
    {
      if (is_array($key))
        foreach($key as $k)
          $this->data[$k] = $val;
      else
        if (is_array($val))
          $this->data[$key] = $val;
      else
        $this->data[$key] = (string) $val;
    }
1076162
public static void addValues(String key, Collection<String> values, MultiValueMap<String, String> params) {
        if (values != null) {
            for (String value : values) {
                params.add(key, value);
            }
        }
    }