| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | final class XmlRenderer extends ThrowableRenderer |
||
| 8 | { |
||
| 9 | public function render(\Throwable $t): string |
||
| 10 | { |
||
| 11 | $out = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; |
||
| 12 | $out .= "<error>\n"; |
||
| 13 | $out .= $this->tag('message', 'An internal server error occurred'); |
||
| 14 | $out .= '</error>'; |
||
| 15 | return $out; |
||
| 16 | } |
||
| 17 | |||
| 18 | public function renderVerbose(\Throwable $t): string |
||
| 19 | { |
||
| 20 | $out = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; |
||
| 21 | $out .= "<error>\n"; |
||
| 22 | $out .= $this->tag('type', get_class($t)); |
||
| 23 | $out .= $this->tag('message', $this->cdata($t->getMessage())); |
||
| 24 | $out .= $this->tag('code', $this->cdata($t->getCode())); |
||
| 25 | $out .= $this->tag('file', $t->getFile()); |
||
| 26 | $out .= $this->tag('line', $t->getLine()); |
||
| 27 | $out .= $this->tag('trace', $t->getTraceAsString()); |
||
| 28 | $out .= '</error>'; |
||
| 29 | return $out; |
||
| 30 | } |
||
| 31 | |||
| 32 | private function tag(string $name, string $value): string |
||
| 35 | } |
||
| 36 | |||
| 37 | private function cdata(string $value): string |
||
| 40 | } |
||
| 41 | } |
||
| 42 |