Add an item to this collection

NOTE: relies on exists() to check the key for invalid values and on set() to normalize it

@param  string $key   Item's key
@param  mixed  $value Item's value
@return mixed         Normalized value
341876
public function add($key, $value = null)
	{
		// Test whether this key is already in use
		if ($this->exists($key))
		{
			// If the action is "ignore" we return the old value, if it's "error" we throw an
			// exception. Otherwise, we keep going and replace the value
			if ($this->onDuplicateAction === 'ignore')
			{
				return $this->get($key);
			}
			elseif ($this->onDuplicateAction === 'error')
			{
				throw $this->getAlreadyExistsException($key);
			}
		}

		return $this->set($key, $value);
	}
534151
protected function setKeyValue($key, $value)
    {
        $this->validateKeyValue($key, $value);

        if ($this->isDefault($key, $value) && $this->isSaved($key)) {
            return $this->deleteRecord($key);
        } elseif ($this->isDefault($key, $value)) {
            return;
        } elseif ($this->isSaved($key)) {
            return $this->updateRecord($key, $value);
        }

        return $this->createRecord($key, $value);
    }
531257
public function prepend($value)
	{
		$value = $this->normalizeValue($value);

		array_unshift($this->items, $value);

		return $value;
	}
637412
public static function set(string $key, $value)
    {
        return self::getViewHelper()->getView()->addValue($key, $value);
    }
978397
protected function addDataInternal($value, $key) {
        if (null === $value || null === $key) {
            return $this;
        }
        $key = $this->processKey($key);
        if ($this->type === static::TYPE_DEFINED_ONLY && !array_key_exists($key, $this->shared)) {
            return $this;
        }
        return $this->addDataByScenario($value, $key);
    }
796613
public function append(string $key, $value)
    {
        $this->content->put($key, $value);

        return $this;
    }
1166592
public function add($key, $value)
    {
        $keys = explode('.', $key);
        $section = &$this->items;

        while (count($keys) > 1) {
            $key = array_shift($keys);

            if (! isset($section[$key])) {
                // If the key does not exist, we will set it to an empty array
                // and move into the next dimension.
                $section[$key] = [];
            } elseif (! is_array($section[$key])) {
                // If the item at this dimension is not an array, then we would
                // be overriding it if we continued any further. As the great
                // master programmer Yoda once said, exit we must.
                return;
            }

            $section = &$section[$key];
        }

        $key = array_shift($keys);

        if (! array_key_exists($key, $section)) {
            $section[$key] = $value;

            $this->notify();
        }
    }
622608
protected function addDataByScenario($value, $key) {
        switch ($this->scenario) {
            case static::SCENARIO_OVERWRITE:
                $this->shared[$key] = $value;
                break;
            case static::SCENARIO_WRITE_ONCE:
                if (!isset($this->shared[$key])) {
                    $this->shared[$key] = $value;
                }
                break;
            case static::SCENARIO_MERGE:
                $this->mergeDataEntry($value, $key);
                break;
        }
        return $this;
    }
65531
public function set($key, $value)
    {
        if (!is_null($key)
            && is_scalar($key)
        ) {
            return $this->_items[$key] = $value;
        } else {
            // given index name is not valid
            throw new EnumeratorException('Element could not be added to list. Index is not valid.', E_NOTICE);
        }
    }
1335748
public function with($key, $value = '')
    {
        if (is_array($key)) {
            $this->appends = $key;
        } elseif (is_callable($value)) {
            $this->appends[$key] = value($value);
        } else {
            $this->appends[$key] = value($value);
        }

        return $this;
    }
82293
public function add( $key, $value ) {
		$storage         = $this->storage;
		$storage[ $key ] = $value;

		return new static( $this->get_key_type(), $this->get_value_type(), $storage );
	}
1320909
public function add($key, $value)
    {
        if ($key === null && is_object($value)) {
            $key = spl_object_hash($value);
        }

        if (!array_key_exists($key, $this->data) && null !== $key) {
            $this->data[$key] = $value;
        } elseif (!array_key_exists($key, $this->data) && null == $key) {
            $this->data[] = $value;
        } elseif (is_array($this->data[$key])) {
            $this->data[$key][] = $value;
        } else {
            $this->data[$key] = [$this->data[$key], $value];
        }

        return $this;
    }
611316
public function define($key, $value)
    {

        if ($this->isProtected($key)) {

            throw new \UnexpectedValueException("Cannot re-assing protected '$key' item");
        }

        parent::set($key, $value);

        $this->protect($key);

        return $this;
    }
230843
public function add($key, $value)
    {
        $array = array_get($this->configs, $key);

        if (is_array($array)) {
            $array[] = $value;
            array_set($this->configs, $key, $array);
        }


        return $this;
    }
803827
public function updateSet($key, $value)
    {
        $update = ( ! $value instanceof SetUpdate)
            ? SetUpdate::createFromArray($value)
            : $value;

        $this->update->updateSet($key, $update->getOp());

        return $this;
    }
841797
public function add($key, $value)
    {
        if (! isset($this->_params[$key])) {
            $this->_params[$key] = array();
        }
        $this->_params[$key][] = $value;
    }
178407
public function add($key, $value) {
    if ($this->exists($key)) {
      throw new SimpleOrderedMapException('Key already exists');
    }
    $this->keys[] = $key;
    $this->values[] = $value;
    return $this;
  }