|
|
|
@ -48,6 +48,7 @@ abstract class Formatter {
|
|
|
|
* @return string The class name to instantiate in accord to the Accept header
|
|
|
|
* @return string The class name to instantiate in accord to the Accept header
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private static function getFormatFromHeader() {
|
|
|
|
private static function getFormatFromHeader() {
|
|
|
|
|
|
|
|
//TODO this is ugly
|
|
|
|
return 'BSR\Lib\Formatter\Json';
|
|
|
|
return 'BSR\Lib\Formatter\Json';
|
|
|
|
if(isset($_SERVER['HTTP_ACCEPT'])) {
|
|
|
|
if(isset($_SERVER['HTTP_ACCEPT'])) {
|
|
|
|
$formats = array_map(function($f) {
|
|
|
|
$formats = array_map(function($f) {
|
|
|
|
@ -74,4 +75,4 @@ abstract class Formatter {
|
|
|
|
* @param array $data
|
|
|
|
* @param array $data
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
abstract public function render($data);
|
|
|
|
abstract public function render($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|