src/Common/Bag.php
public function replace(array $elements = array())
    {
        $this->elements = array();

        foreach ($elements as $element) {
            $this->add($element);
        }
    }
public function replace(array $elements = array())
    {
        $this->elements = array();

        foreach ($elements as $element) {
            $this->add($element);
        }
    }
public function replace ( array $ elements = array ( ) ) { $ this -> elements = array ( ) ; foreach ( $ elements as $ element ) { $ this -> add ( $ element ) ; } }
Replace the contents of this bag with the specified elements

@param array $elements An array of elements
Replace the contents of this bag with the specified elements