summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold Daniels <arnold@jasny.net>2016-12-02 21:21:24 +0100
committerArnold Daniels <arnold@jasny.net>2016-12-02 21:21:24 +0100
commit524ba70049f5c85d66346f0dd802dc10f2b149da (patch)
tree410716c794f3732e76e472c9d2604face9646954
parent7b9ac3d4694d5384dbcbb38e79a1763ff2a33903 (diff)
downloadcontroller-origin/cancel-action.zip
controller-origin/cancel-action.tar.gz
controller-origin/cancel-action.tar.bz2
Break up `output()` methodorigin/cancel-action
-rw-r--r--src/Controller/Output.php23
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);