1 | <?php |
||
15 | class HTTPOutputHandler extends AbstractProcessingHandler |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $contentType = "text/html"; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | private $statusCode = 500; |
||
27 | |||
28 | /** |
||
29 | * @var FormatterInterface |
||
30 | */ |
||
31 | private $cliFormatter = null; |
||
32 | |||
33 | /** |
||
34 | * Get the mime type to use when displaying this error. |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getContentType() |
||
42 | |||
43 | /** |
||
44 | * Set the mime type to use when displaying this error. |
||
45 | * Default text/html |
||
46 | * |
||
47 | * @param string $contentType |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function setContentType($contentType) |
||
55 | |||
56 | /** |
||
57 | * Get the HTTP status code to use when displaying this error. |
||
58 | * |
||
59 | * @return int |
||
60 | */ |
||
61 | public function getStatusCode() |
||
65 | |||
66 | /** |
||
67 | * Set the HTTP status code to use when displaying this error. |
||
68 | * Default 500 |
||
69 | * |
||
70 | * @param int $statusCode |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function setStatusCode($statusCode) |
||
78 | |||
79 | /** |
||
80 | * Set a formatter to use if Director::is_cli() is true |
||
81 | * |
||
82 | * @param $cliFormatter |
||
83 | */ |
||
84 | public function setCLIFormatter(FormatterInterface $cliFormatter) |
||
90 | |||
91 | /** |
||
92 | * Return the formatter use if Director::is_cli() is true |
||
93 | * If none has been set, null is returned, and the getFormatter() result will be used instead |
||
94 | */ |
||
95 | public function getCLIFormatter() |
||
99 | |||
100 | /** |
||
101 | * Return the formatter to use in this case. |
||
102 | * May be the getCliFormatter() value if one is provided and Director::is_cli() is true. |
||
103 | */ |
||
104 | public function getFormatter() |
||
112 | |||
113 | /** |
||
114 | * @param array $record |
||
115 | * @return bool |
||
116 | */ |
||
117 | protected function write(array $record) |
||
143 | } |
||
144 |