1 | <?php |
||
16 | class LazyAssertionException extends \InvalidArgumentException |
||
17 | { |
||
18 | /** |
||
19 | * @var InvalidArgumentException[] |
||
20 | */ |
||
21 | private $errors = array(); |
||
22 | |||
23 | /** |
||
24 | * @param InvalidArgumentException[] $errors |
||
25 | * @return self |
||
26 | */ |
||
27 | static public function fromErrors(array $errors) |
||
|
|||
28 | { |
||
29 | $message = sprintf('The following %d assertions failed:' , count($errors)) . "\n"; |
||
30 | |||
31 | $i = 1; |
||
32 | foreach ($errors as $error) { |
||
33 | $message .= sprintf("%d) %s: %s\n", $i++, $error->getPropertyPath(), $error->getMessage()); |
||
34 | } |
||
35 | |||
36 | return new self($message, $errors); |
||
37 | } |
||
38 | |||
39 | public function __construct($message, array $errors) |
||
40 | { |
||
41 | parent::__construct($message, 0); |
||
42 | |||
43 | $this->errors = $errors; |
||
44 | } |
||
45 | |||
46 | public function getErrorExceptions() |
||
50 | } |
||
51 |