Adds a value to this collection

@param scalar $value
422917
public function add($value)
    {
        if ( ! is_scalar($value)) {
            throw new InvalidArgumentException(sprintf(
                'Argument 1 passed to %s must be a scalar value, %s given',
                __METHOD__,
                is_object($value) ? get_class($value) : gettype($value)
            ));
        }

        parent::offsetSet(null, $value);
    }
28214
public function append($value)
    {
        if ($this->isValidType($value) === false) {
            throw new MWrongTypeException("\$value", $this->getType(), $value);
        }

        $this->list[] = $value;
    }
818148
public final void addValue(@NonNull final String value) {
        Condition.INSTANCE.ensureNotNull(value, "The value may not be null");

        if (this.values != null) {
            if (this.values.add(value)) {
                if (persistSet(this.values)) {
                    notifyChanged();
                }
            }
        } else {
            Set<String> newValues = new HashSet<>();
            newValues.add(value);
            setValues(newValues);
        }
    }
884526
public function addCustomsDeclarationNumbers($value)
    {
        if ($this->CustomsDeclarationNumbers === null) {
            $this->CustomsDeclarationNumbers = new \Protobuf\ScalarCollection();
        }

        $this->CustomsDeclarationNumbers->add($value);
    }
636505
private function addIntoAllowedValues($value)
    {
        if (empty($this->getType())) {
            return false;
        }

        if (in_array(
                $value,
                $this->allowedValues
        )) {
            return false;
        }

        switch ($this->getType()) {
            case 'int' :
                $value = intval($value);

                $this->allowedValues[] = $value;

                return true;

            case 'float' :
                $value = floatval($value);

                $this->allowedValues[] = $value;

                return true;
            case 'string' :
                $value = (string)$value;

                $this->allowedValues[] = $value;

                return true;
            default:

                return false;
        }
    }
101911
public function addPublicDependency($value)
    {
        if ($this->public_dependency === null) {
            $this->public_dependency = new \Protobuf\ScalarCollection();
        }

        $this->public_dependency->add($value);
    }
711241
public function addDraftIsTransformedToMessageIdList($value)
    {
        if ($this->DraftIsTransformedToMessageIdList === null) {
            $this->DraftIsTransformedToMessageIdList = new \Protobuf\ScalarCollection();
        }

        $this->DraftIsTransformedToMessageIdList->add($value);
    }
161058
public function addValue($value)
    {
        $this->values = array_values(
            array_unique(
                array_merge($this->values, $this->prepareValues($value))
            )
        );
    }
125946
public
    function add(
        $value = null,
        $key = ''
    ) {
        //var_dump($this->type);
        //var_dump($value);
        //var_dump(is_object($value));
        //die;

        if ($this->isClass) {
            //echo "  isClass".PHP_EOL;
            if (!is_a($value, $this->type)) {
                //throw new TypeCheckException('Object type "'.get_class($value).'" is not of type "'.$this->type.'".');
                $type = is_object($value) ? get_class($value) : gettype($value);
                throw new TypeCheckException('Object type "'.$type.'" is not of type "'.$this->type.'".');
            } else {
                // add to collection
                if ($key != '') {
                    if (array_key_exists($key, $this->collection)) {
                        throw new ArgumentException(
                            'Can not add object to key "'.$key.'", because key already exists.'
                        );
                    } else {
                        $this->collection[$key] = $value;
                    }
                } else {
                    array_push($this->collection, $value);
                }
            }
        } else {
            //echo "  noClass".PHP_EOL;
            if ($this->type == gettype($value)) {
                // add to collection
                if ($key != '') {
                    if (array_key_exists($key, $this->collection)) {
                        throw new ArgumentException('Can not add value to key "'.$key.'", because key already exists.');
                    } else {
                        $this->collection[$key] = $value;
                    }
                } else {
                    array_push($this->collection, $value);
                }
            } else {
                throw new TypeCheckException('Value type "'.gettype($value).'" is not of type "'.$this->type.'".');
            }
        }
    }
841797
public function add($key, $value)
    {
        if (! isset($this->_params[$key])) {
            $this->_params[$key] = array();
        }
        $this->_params[$key][] = $value;
    }
1237909
public function addItem($value)
    {
        $this->_items[] = $value;
        if ($value->isShipping()) {
            $this->_shippingItems[] = $value;
        }
    }
230647
public function setValue($value)
    {
        if ((\is_scalar($value) && \is_numeric($value))) {
            $this->value = (float) $value;
        } elseif (\is_object($value) && $value instanceof self) {
            $this->value = $value->getValue();
        }

        throw new \InvalidArgumentException('Expected double');
    }
605038
public function set($key, $value)
    {
        Assume::that(is_scalar($key));
        if (isset($this->emptySubset)) {
            $this->createTrueSubset();
        }
        $oldValue = null;
        if (isset($this->data[$key])) {
            $oldValue = $this->data[$key];
        }
        if (isset($key) and isset($value) and $key !== '') {
            $this->data[$key] = $value;
        } else {
            $this->data[$key] = null;
        }
        if (! $this->root->updated and $oldValue !== $value) {
            $this->root->updated = true;
            $this->root->update();
        }
    }
391396
public function add($value): SetInterface
    {
        $this->resolver->value(function ($value): void {
            $this->items->add($value);
        }, $value);

        return $this;
    }
940325
public function pushValue($value)
    {
        $old = $this->value;
        if (!$this->stackable) {
            $this->setValue($value);
            return;
        }
        if (!is_array($this->value)) {
            $this->value = [$this->value, $value];
        } else {
            $f = false;
            foreach ($this->value as $k => $v) {
                if (!is_int($k)) {
                    $f = true;
                    break;
                }
            }
            if (!$f) {
                $this->value[] = $value;
            } else {
                $this->value = [$this->value, $value];
            }
        }
        $this->onUpdate($old);
    }
1077713
public function set($collection, $value = null)
    {
        if (func_num_args() === 1) {
            return parent::merge($collection, true);
        }
        $this->_data[$collection] = $value;
        return $this;
    }
251650
public function add($values)
    {
        if (! is_array($values) && ! $values instanceof BaseCollection) {
            $values = func_get_args();
        }

        // Once we have made sure our input is an array of values, we will convert
        // them into value model objects (if no model instances are given). When
        // done we will just push all values into the current collection items.
        foreach ($values as $value) {
            $this->push($this->buildValue($value));
        }

        return $this;
    }