mirror of
https://github.com/friendica/friendica
synced 2025-04-20 19:10:11 +00:00
Transform ApiResponse::formatData() into dynamic method
This commit is contained in:
parent
f28e64299e
commit
4309f814e0
3 changed files with 55 additions and 55 deletions
|
@ -87,13 +87,13 @@ class ApiResponse
|
|||
*
|
||||
* @return array|string (string|array) XML data or JSON data
|
||||
*/
|
||||
public static function formatData(string $root_element, string $type, array $data)
|
||||
public function formatData(string $root_element, string $type, array $data)
|
||||
{
|
||||
switch ($type) {
|
||||
case 'atom':
|
||||
case 'rss':
|
||||
case 'xml':
|
||||
$ret = DI::apiResponse()->createXML($data, $root_element);
|
||||
$ret = $this->createXML($data, $root_element);
|
||||
break;
|
||||
case 'json':
|
||||
default:
|
||||
|
@ -161,7 +161,7 @@ class ApiResponse
|
|||
{
|
||||
$format = $format ?? 'json';
|
||||
|
||||
$return = static::formatData($root_element, $format, $data);
|
||||
$return = DI::apiResponse()->formatData($root_element, $format, $data);
|
||||
|
||||
switch ($format) {
|
||||
case 'xml':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue