1: <?php
2:
3: namespace PHPixie\Framework\Processors\HTTP\Response;
4:
5: 6: 7:
8: class Exception implements \PHPixie\Processors\Processor
9: {
10: 11: 12:
13: protected $debug;
14:
15: 16: 17:
18: protected $http;
19:
20: 21: 22:
23: protected $template;
24:
25: 26: 27:
28: protected $configData;
29:
30: 31: 32: 33: 34: 35: 36:
37: public function __construct($debug, $http, $template, $configData)
38: {
39: $this->debug = $debug;
40: $this->http = $http;
41: $this->template = $template;
42: $this->configData = $configData;
43: }
44:
45: 46: 47: 48: 49:
50: public function process($exception)
51: {
52: $templateName = $this->configData->getRequired('template');
53: $trace = $this->debug->exceptionTrace($exception);
54:
55: $body = $this->template->render(
56: $templateName,
57: array(
58: 'exception' => $exception,
59: 'trace' => $trace,
60: 'logger' => $this->debug->logger()
61: )
62: );
63:
64: return $this->http->responses()->response($body, array(), 500);
65: }
66: }