Actual logic for adding an element to the collection.

@param mixed $value
@param bool  $arrayAccess

@return bool
351118
private function doAdd($value, $arrayAccess)
    {
        /* Initialize the collection before calling add() so this append operation
         * uses the appropriate key. Otherwise, we risk overwriting original data
         * when $newObjects are re-added in a later call to initialize().
         */
        if ($this->mapping->type === Type::MAP) {
            $this->initialize();
        }
        $arrayAccess ? $this->coll->offsetSet(null, $value) : $this->coll->add($value);
        $this->changed();

        if ($this->uow !== null && $this->isOrphanRemovalEnabled() && $value !== null) {
            $this->uow->unscheduleOrphanRemoval($value);
        }

        return true;
    }
692628
public function offsetSet($offset, $value) {
    if (NULL === $offset) {
      $this->container[] = [$value, NULL];
      return;
    }
    $this->container[$this->getHash($offset)] = [$value, $offset];
  }
136431
public function offsetSet($offset, $value): void
    {
        if (null === $offset) {
            throw new \InvalidArgumentException('Class `Common\Container\ArrayAccess` support only associative arrays');
        }
        $this->doSetContainer($offset, $value);
    }
564559
public function insert($offset, $value)
	{
		$offset = $this->normalizeKey($offset);
		$value  = $this->normalizeValue($value);

		// Insert the value at given offset. We put the value into an array so that array_splice()
		// won't insert it as multiple elements if it happens to be an array
		array_splice($this->items, $offset, 0, [$value]);

		return $value;
	}
1302614
public function offsetSet($offset, $value) {
		if (is_array($value)) {
			$this->addChildren($value, is_string($offset) ? $offset : null);
			return;
		}
		
		$this->addChild($value, $offset);
	}
589434
public function addXmlAcceptanceCertificateSellerTitles(\AgentSIB\Diadoc\Api\Proto\Events\XmlDocumentAttachment $value)
    {
        if ($this->XmlAcceptanceCertificateSellerTitles === null) {
            $this->XmlAcceptanceCertificateSellerTitles = new \Protobuf\MessageCollection();
        }

        $this->XmlAcceptanceCertificateSellerTitles->add($value);
    }
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;
    }
842237
public function addObject($value, $blnAddToBeginning = false)
    {
        if ($blnAddToBeginning) {
            array_unshift($this->collection, $value);
        } else {
            array_push($this->collection, $value);
        }
    }
682814
public function add($value)
    {
        if (is_array($value)) {
            return $this->handleArray('add', $value);
        }
        if (is_null($value) || strlen($value) == 0) {
            return false;
        }
        if (false !== array_search($value, $this->values)) {
            return false;
        }
        $this->offsetSet(null, $value);
        return true;
    }
1327652
public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            throw new \Exception('Must supply key to modify arguments in an AssociativeArray.');
        } else {
            $this->_args[$offset] = $value;
        }
    }
1101830
public function visitArrayValue(Value\ArrayValue $value)
    {
        $subValues = array();
        foreach ($value as $index => $subValue) {
            $this->pushContextAtom(strval($index));
            $subValues[$index] = $subValue->accept($this);
            $this->popContextAtom();
        }

        return new Value\ArrayValue($subValues);
    }
85417
public function offsetSet($offset, $value)
    {
        if (!($value instanceof FormField))
            throw new InvalidArgumentException("Value must be a FormField");

        $this->form_elements[$offset] = $value; 
    }
1107215
public function add($value)
    {
        if (!$value instanceof EmailBodyPart) {
            throw new InvalidArgumentException(
                sprintf(
                    '%s only accepts instances of %s.',
                    __FUNCTION__, EmailBodyPart::class
                )
            );
        }

        return parent::add($value);
    }
1373231
public function offsetSet($offset, $value)
    {
        $this->prepareCursor();
        $this->collectionCursor->offsetSet($offset, $value);
    }
583482
public function add($value)
    {
        $mapping = $this->getMapping();

        $value = $this->getExpr()->value($value);
        $value->setMapping($mapping);

        return $this->getExpr()->addUpdate(new Add($this, $value));
    }
742200
public function add($value): bool
    {
        if ($this->has($value)) {
            return false;
        }

        $this->set($value);

        return true;
    }
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;
        }
    }