public function Collection::merge

Add and merge in a Collection or array of key value pair data.

Parameters

Collection|array $data Associative array of key value pair data:

Return value

Collection Returns a reference to the object.

File

drupal/core/vendor/guzzle/common/Guzzle/Common/Collection.php, line 242

Class

Collection
Key value pair collection object

Namespace

Guzzle\Common

Code

public function merge($data) {
  if ($data instanceof self) {
    $data = $data
      ->getAll();
  }
  elseif (!is_array($data)) {
    return $this;
  }
  if (empty($this->data)) {
    $this->data = $data;
  }
  else {
    foreach ($data as $key => $value) {
      $this
        ->add($key, $value);
    }
  }
  return $this;
}