public function merge(array $attributes = array(), $hard = false)
    {
        // Don't waste our time with an "array_merge" call if the array is empty
        if (!empty($attributes)) {
            // Hard merge?
            if ($hard) {
                $this->attributes = array_replace(
                    $this->attributes,
                    $attributes
                );
            } else {
                $this->attributes = array_merge(
                    $this->attributes,
                    $attributes
                );
            }
        }

        return $this;
    }
public function merge(array $attributes = array(), $hard = false)
    {
        // Don't waste our time with an "array_merge" call if the array is empty
        if (!empty($attributes)) {
            // Hard merge?
            if ($hard) {
                $this->attributes = array_replace(
                    $this->attributes,
                    $attributes
                );
            } else {
                $this->attributes = array_merge(
                    $this->attributes,
                    $attributes
                );
            }
        }

        return $this;
    }
public function merge ( array $ attributes = array ( ) , $ hard = false ) { // Don't waste our time with an "array_merge" call if the array is empty if ( ! empty ( $ attributes ) ) { // Hard merge? if ( $ hard ) { $ this -> attributes = array_replace ( $ this -> attributes , $ attributes ) ; } else { $ this -> attributes = array_merge ( $ this -> attributes , $ attributes ) ; } } return $ this ; }
Merge attributes with the collection's attributes

Optionally allows a second boolean parameter to merge the attributes
into the collection in a "hard" manner, using the "array_replace"
method instead of the usual "array_merge" method

@param array $attributes The attributes to merge into the collection
@param boolean $hard     Whether or not to make the merge "hard"
@return DataCollection
Merge attributes with the collection s attributes