AggregateException::setObjectProphecy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Prophecy.
5
 * (c) Konstantin Kudryashov <[email protected]>
6
 *     Marcello Duarte <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Prophecy\Exception\Prediction;
13
14
use Prophecy\Prophecy\ObjectProphecy;
15
16
class AggregateException extends \RuntimeException implements PredictionException
17
{
18
    private $exceptions = array();
19
    private $objectProphecy;
20
21
    public function append(PredictionException $exception)
22
    {
23
        $message = $exception->getMessage();
24
        $message = strtr($message, array("\n" => "\n  "))."\n";
25
        $message = empty($this->exceptions) ? $message : "\n" . $message;
26
27
        $this->message      = rtrim($this->message.$message);
28
        $this->exceptions[] = $exception;
29
    }
30
31
    /**
32
     * @return PredictionException[]
33
     */
34
    public function getExceptions()
35
    {
36
        return $this->exceptions;
37
    }
38
39
    public function setObjectProphecy(ObjectProphecy $objectProphecy)
40
    {
41
        $this->objectProphecy = $objectProphecy;
42
    }
43
44
    /**
45
     * @return ObjectProphecy
46
     */
47
    public function getObjectProphecy()
48
    {
49
        return $this->objectProphecy;
50
    }
51
}
52