public function addMany($items, $prepend = false)
    {
        $this->emitOnChange(__METHOD__);
        if ($prepend) {
            # if items must be added to beginning, we need to reverse them
            if (!is_array($items)) {
                $items = iterator_to_array($items);
            }
            $items = array_reverse($items);
        }
        foreach ($items as $item) {
            $this->add($item, $prepend);
        }
        $this->endEmitOnChange(__METHOD__);
        return $this;
    }
public function addMany($items, $prepend = false)
    {
        $this->emitOnChange(__METHOD__);
        if ($prepend) {
            # if items must be added to beginning, we need to reverse them
            if (!is_array($items)) {
                $items = iterator_to_array($items);
            }
            $items = array_reverse($items);
        }
        foreach ($items as $item) {
            $this->add($item, $prepend);
        }
        $this->endEmitOnChange(__METHOD__);
        return $this;
    }
public function addMany ( $ items , $ prepend = false ) { $ this -> emitOnChange ( __METHOD__ ) ; if ( $ prepend ) { # if items must be added to beginning, we need to reverse them if ( ! is_array ( $ items ) ) { $ items = iterator_to_array ( $ items ) ; } $ items = array_reverse ( $ items ) ; } foreach ( $ items as $ item ) { $ this -> add ( $ item , $ prepend ) ; } $ this -> endEmitOnChange ( __METHOD__ ) ; return $ this ; }
Adds multiple items to collection.

@param array|Traversable $items
@param bool $prepend false by default

@return $this
Adds multiple items to collection .