Chris@0: Chris@0: * Marcello Duarte Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Prophecy\Exception\Prediction; Chris@0: Chris@0: use Prophecy\Prophecy\ObjectProphecy; Chris@0: Chris@0: class AggregateException extends \RuntimeException implements PredictionException Chris@0: { Chris@0: private $exceptions = array(); Chris@0: private $objectProphecy; Chris@0: Chris@0: public function append(PredictionException $exception) Chris@0: { Chris@0: $message = $exception->getMessage(); Chris@17: $message = strtr($message, array("\n" => "\n "))."\n"; Chris@17: $message = empty($this->exceptions) ? $message : "\n" . $message; Chris@0: Chris@0: $this->message = rtrim($this->message.$message); Chris@0: $this->exceptions[] = $exception; Chris@0: } Chris@0: Chris@0: /** Chris@0: * @return PredictionException[] Chris@0: */ Chris@0: public function getExceptions() Chris@0: { Chris@0: return $this->exceptions; Chris@0: } Chris@0: Chris@0: public function setObjectProphecy(ObjectProphecy $objectProphecy) Chris@0: { Chris@0: $this->objectProphecy = $objectProphecy; Chris@0: } Chris@0: Chris@0: /** Chris@0: * @return ObjectProphecy Chris@0: */ Chris@0: public function getObjectProphecy() Chris@0: { Chris@0: return $this->objectProphecy; Chris@0: } Chris@0: }