1 | <?php |
||
11 | class Unbound extends \LogicException implements ExceptionInterface |
||
12 | { |
||
13 | 3 | public function __toString() |
|
14 | { |
||
15 | 3 | $messages = [sprintf("- %s\n", $this->getMessage())]; |
|
16 | 3 | $e = $this->getPrevious(); |
|
17 | 3 | if (! $e instanceof \Exception) { |
|
18 | 1 | return $this->getMainMessage($this); |
|
19 | } |
||
20 | 2 | if ($e instanceof Unbound) { |
|
21 | 1 | return $this->buildMessage($e, $messages) . "\n" . $e->getTraceAsString(); |
|
22 | } |
||
23 | |||
24 | 1 | return parent::__toString(); |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param Unbound $e |
||
29 | * @param string[] $msg |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | 1 | private function buildMessage(Unbound $e, array $msg) |
|
46 | |||
47 | 2 | private function getMainMessage(Unbound $e) |
|
55 | } |
||
56 |