4 * This file is part of the Prophecy.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6 * Marcello Duarte <marcello.duarte@gmail.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Prophecy\Exception\Prediction;
14 use Prophecy\Prophecy\ObjectProphecy;
16 class AggregateException extends \RuntimeException implements PredictionException
18 private $exceptions = array();
19 private $objectProphecy;
21 public function append(PredictionException $exception)
23 $message = $exception->getMessage();
24 $message = strtr($message, array("\n" => "\n "))."\n";
25 $message = empty($this->exceptions) ? $message : "\n" . $message;
27 $this->message = rtrim($this->message.$message);
28 $this->exceptions[] = $exception;
32 * @return PredictionException[]
34 public function getExceptions()
36 return $this->exceptions;
39 public function setObjectProphecy(ObjectProphecy $objectProphecy)
41 $this->objectProphecy = $objectProphecy;
45 * @return ObjectProphecy
47 public function getObjectProphecy()
49 return $this->objectProphecy;