1 | <?php |
||
17 | abstract class ConstraintException extends \Exception |
||
18 | { |
||
19 | /** |
||
20 | * @var Context |
||
21 | */ |
||
22 | private $context; |
||
23 | |||
24 | /** |
||
25 | * @var mixed |
||
26 | */ |
||
27 | private $target; |
||
28 | |||
29 | /** |
||
30 | * Constructor. |
||
31 | * |
||
32 | * @param Context $context The current validation context |
||
33 | * @param mixed $target An optional exception target not |
||
34 | * present in the current context |
||
35 | */ |
||
36 | 61 | public function __construct(Context $context, $target = null) |
|
43 | |||
44 | /** |
||
45 | * @return string |
||
46 | */ |
||
47 | 61 | public function getPath() |
|
51 | |||
52 | /** |
||
53 | * @return mixed |
||
54 | */ |
||
55 | 59 | public function getTarget() |
|
59 | |||
60 | /** |
||
61 | * Builds the exception message. |
||
62 | */ |
||
63 | abstract protected function buildMessage(); |
||
64 | |||
65 | /** |
||
66 | * Returns a printable representation of the exception |
||
67 | * target. If no target has been explicitly passed in, |
||
68 | * the last non-array segments of the path are returned. |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | 59 | protected function getTargetNode() |
|
92 | } |
||
93 |