Adds an element to that array

@param mixed $element
@param int $index
@return $this
971431
public function add($element, $index = null) {
		if ($index === null) {
			$this->array[$this->count()] = $element;
		} else {
			array_splice($this->array, $index, 0, $element);
		}

		return $this;
	}
551701
public function set($index, $value = null)
    {
        if (is_array($index)) {
            $this->data = array_merge($this->data, $index);
        } else {
            $this->data[$index] = $value;
        }
        return $this;
    }
312687
public int set(int index, int element)
    {
        boundsCheck(index);
        int prev = array[index];
        array[index] = element;
        return prev;
    }
1125452
@Override
    public void add(int index, Object element) {
        rewrite |= index < delegate.size();

        delegate.add(index, element);
    }
968172
public function add($key, $element): self
    {
        $callback = $this->callback;

        $this->index[$callback($element)] = $key;

        return $this;
    }
733669
function add($element)
    {
        if(get_class($element) !== $this->manager->getModel()){
            throw new InvalidArgumentException("This element is not compatible with this collection, it only support  ".$this->manager->getModel());
        }
        return array_push($this->elements,$this->manager->hydrate($element));
    }
1146404
public function addIndex($index)
    {
        if ($index instanceof Index) {
            $index = $index->getName();
        }

        if (!\is_scalar($index)) {
            throw new InvalidException('Invalid param type');
        }

        $this->_indices[] = (string) $index;

        return $this;
    }
59245
public function setId($index): self
    {
        \assert($index === null || \is_int($index) === true || \is_string($index) === true);

        $this->index = $index;

        return $this;
    }
783744
public function appendChild(Element $element)
	{
		$this->beforeInsert($element);
		
		array_push($this->children, $element);
		
		$this->afterInsert();
		
		return $this;
	}
906571
public function insert($index, $string)
    {
        // NOTE: This could be slightly confusing as the parameters
        // are back to front. I guess I could change the Str version...

        $this->str = $this->str->insert((string)$string, $index);

        return $this;
    }
401834
public function with($index, $value)
    {
        $res = clone $this;

        $res->fragments = $this->insertInList($res->fragments, $index, $value);

        return $this;
    }
272592
protected function addElement($element)
    {
        if($element->getData() == null) {
            throw new Exception("Invalid Element data: null is not allowed.");
        }
        if ($this->elementExistsWith($element->getData())) {
            $this->addWeightToExisting($element);
        } else {
            $this->elements[] = $element;
        }

        return $this;
    }
504036
public function add($index, $data = null, $toAdmin = false)
	{
		if (!$this->has($index))
		{
			$this->data = Arr::add($this->data, $index, $data);

			$this->metas = Arr::add($this->metas, $this->firstIndex($index), ['admin' => $toAdmin]);
		}

		return $this;
	}
437721
public function addElement(Element $element)
    {
        if (!in_array($element, $this->elements, true)) {
            array_push($this->elements, $element);
        }
        return $this;
    }
545923
public function set($index, $element)
    {
        if (null === $index) {
            $this->collections[] = $element;
        } else {
            $this->collections[$index] = $element;
        }

        return $this;
    }
838784
public function set($index, $newValue) {
        if (!$this->offsetSet($index, $newValue)) {
            $this->append($newValue);
        }

        return $this;
    }
874219
public function addElement($element){

        $elements = $this->formElements;
        $elements[] = $element;

        $this->formElements = $elements;

        return $this;
    }