diff options
author | Arnold Daniels <arnold@jasny.net> | 2016-12-02 21:21:24 +0100 |
---|---|---|
committer | Arnold Daniels <arnold@jasny.net> | 2016-12-02 21:21:24 +0100 |
commit | 524ba70049f5c85d66346f0dd802dc10f2b149da (patch) | |
tree | 410716c794f3732e76e472c9d2604face9646954 /src/Controller/Output.php | |
parent | 7b9ac3d4694d5384dbcbb38e79a1763ff2a33903 (diff) | |
download | controller-origin/cancel-action.zip controller-origin/cancel-action.tar.gz controller-origin/cancel-action.tar.bz2 |
Break up `output()` methodorigin/cancel-action
Diffstat (limited to 'src/Controller/Output.php')
-rw-r--r-- | src/Controller/Output.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/Controller/Output.php b/src/Controller/Output.php index 293ae6e..8eecc8b 100644 --- a/src/Controller/Output.php +++ b/src/Controller/Output.php @@ -377,12 +377,12 @@ trait Output } /** - * Output result - * - * @param mixed $data - * @param string $format Output format as MIME or extension + * Set the content type for the output + * + * @param string $format + * @return string */ - public function output($data, $format = null) + protected function outputContentType($format) { if (!isset($format)) { $contentType = $this->getResponse()->getHeaderLine('Content-Type'); @@ -396,6 +396,19 @@ trait Output $contentType = $this->getContentType($format); $this->setResponseHeader('Content-Type', $contentType); } + + return $contentType; + } + + /** + * Output result + * + * @param mixed $data + * @param string $format Output format as MIME or extension + */ + public function output($data, $format = null) + { + $contentType = $this->outputContentType($format); try { $content = $this->serializeData($data, $contentType); |