diff options
Diffstat (limited to 'formats/JsonFormat.php')
-rw-r--r-- | formats/JsonFormat.php | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/formats/JsonFormat.php b/formats/JsonFormat.php index e173f230..ac6e450a 100644 --- a/formats/JsonFormat.php +++ b/formats/JsonFormat.php @@ -3,19 +3,18 @@ * Json * Builds a JSON string from $this->items and return it to browser. */ -class JsonFormat extends FormatAbstract{ +class JsonFormat extends FormatAbstract { - public function stringify(){ - $items = $this->getItems(); + public function stringify(){ + $items = $this->getItems(); + return json_encode($items, JSON_PRETTY_PRINT); + } - return json_encode($items, JSON_PRETTY_PRINT); - } + public function display(){ + $this + ->setContentType('application/json') + ->callContentType(); - public function display(){ - $this - ->setContentType('application/json') - ->callContentType(); - - return parent::display(); - } + return parent::display(); + } } |