File modules/cms/output/PHPArrayOutput.class.php
Last commit: Sun Jan 5 23:15:04 2025 +0100 Jan Dankert It is not useful to simple output the PHP data array as JSON, as we always have an output for text/json. So it is better to output the native PHP array here and it is machine readable.
1 <?php 2 3 namespace cms\output; 4 5 use cms\output\APIOutput; 6 use util\json\JSON; 7 8 /** 9 * Rendering as PHP array. 10 */ 11 class PHPArrayOutput extends APIOutput 12 { 13 /** 14 * Renders the output as machine-readable PHP array format. 15 */ 16 protected function renderOutput( $data ) 17 { 18 return var_export($data, true); 19 } 20 21 public function getContentType() 22 { 23 return 'application/php-array'; 24 } 25 }
Downloadmodules/cms/output/PHPArrayOutput.class.php
History Sun, 5 Jan 2025 23:15:04 +0100 Jan Dankert It is not useful to simple output the PHP data array as JSON, as we always have an output for text/json. So it is better to output the native PHP array here and it is machine readable. Mon, 31 Jan 2022 00:00:48 +0100 dankert Some documentation... Sun, 30 Jan 2022 23:38:42 +0100 dankert Refactoring: Only 1 http-endpoint for both the UI and the API. Path "/api" is not available any more, all API data is served under "/".