Total Complexity | 8 |
Total Lines | 75 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class ConvertHelper_ThrowableInfo_StringConverter |
||
8 | { |
||
9 | /** |
||
10 | * @var ConvertHelper_ThrowableInfo |
||
11 | */ |
||
12 | private $info; |
||
13 | |||
14 | public function __construct(ConvertHelper_ThrowableInfo $info) |
||
17 | } |
||
18 | |||
19 | public function toString() : string |
||
20 | { |
||
21 | return |
||
22 | $this->renderMessage() . |
||
23 | $this->renderCalls() . |
||
24 | $this->renderPrevious(); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @return string |
||
29 | */ |
||
30 | private function renderMessage() : string |
||
31 | { |
||
32 | $string = 'Exception'; |
||
33 | |||
34 | if ($this->info->hasCode()) |
||
35 | { |
||
36 | $string .= ' #' . $this->info->getCode(); |
||
37 | } |
||
38 | |||
39 | $string .= |
||
40 | ': ' . |
||
41 | $this->info->getMessage() . |
||
42 | PHP_EOL; |
||
43 | |||
44 | return $string; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return string |
||
49 | */ |
||
50 | private function renderCalls() : string |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return string |
||
66 | * @throws ConvertHelper_Exception |
||
67 | */ |
||
68 | private function renderPrevious() : string |
||
82 | } |
||
83 | } |
||
84 |