public function ExceptionCollection::add

Add exceptions to the collection

Parameters

ExceptionCollection|\Exception $e Exception to add:

Return value

ExceptionCollection;

File

drupal/core/vendor/guzzle/common/Guzzle/Common/Exception/ExceptionCollection.php, line 22

Class

ExceptionCollection
Collection of exceptions

Namespace

Guzzle\Common\Exception

Code

public function add($e) {
  if ($e instanceof self) {
    foreach ($e as $exception) {
      $this->exceptions[] = $exception;
    }
  }
  elseif ($e instanceof \Exception) {
    $this->exceptions[] = $e;
  }
  $this->message = implode("\n", array_map(function ($e) {
    return $e
      ->getMessage();
  }, $this->exceptions));
  return $this;
}