diff --git a/src/DI.php b/src/DI.php
index 692d87870..ead125cff 100644
--- a/src/DI.php
+++ b/src/DI.php
@@ -430,6 +430,15 @@ abstract class DI
return self::$dice->create(Model\Log\ParsedLogIterator::class);
}
+ //
+ // "Module" namespace
+ //
+
+ public static function apiResponse(): Module\Api\ApiResponse
+ {
+ return self::$dice->create(Module\Api\ApiResponse::class);
+ }
+
//
// "Network" namespace
//
diff --git a/src/Module/Api/ApiResponse.php b/src/Module/Api/ApiResponse.php
index 768dacb5f..270185025 100644
--- a/src/Module/Api/ApiResponse.php
+++ b/src/Module/Api/ApiResponse.php
@@ -40,15 +40,17 @@ class ApiResponse
*
* @return string The XML data
*/
- public static function createXML(array $data, string $root_element): string
+ public function createXML(array $data, string $root_element): string
{
$childname = key($data);
$data2 = array_pop($data);
- $namespaces = ['' => 'http://api.twitter.com',
- 'statusnet' => 'http://status.net/schema/api/1/',
- 'friendica' => 'http://friendi.ca/schema/api/1/',
- 'georss' => 'http://www.georss.org/georss'];
+ $namespaces = [
+ '' => 'http://api.twitter.com',
+ 'statusnet' => 'http://status.net/schema/api/1/',
+ 'friendica' => 'http://friendi.ca/schema/api/1/',
+ 'georss' => 'http://www.georss.org/georss'
+ ];
/// @todo Auto detection of needed namespaces
if (in_array($root_element, ['ok', 'hash', 'config', 'version', 'ids', 'notes', 'photos'])) {
@@ -91,7 +93,7 @@ class ApiResponse
case 'atom':
case 'rss':
case 'xml':
- $ret = static::createXML($data, $root_element);
+ $ret = DI::apiResponse()->createXML($data, $root_element);
break;
case 'json':
default:
diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php
index 4ea5c784a..c5d28f2d5 100644
--- a/tests/legacy/ApiTest.php
+++ b/tests/legacy/ApiTest.php
@@ -1114,7 +1114,7 @@ class ApiTest extends FixtureTest
'xmlns:georss="http://www.georss.org/georss">' . "\n" .
' some_data' . "\n" .
'' . "\n",
- ApiResponse::createXML(['data' => ['some_data']], 'root_element')
+ DI::apiResponse()->createXML(['data' => ['some_data']], 'root_element')
);
}
@@ -1130,7 +1130,7 @@ class ApiTest extends FixtureTest
'' . "\n" .
' some_data' . "\n" .
'' . "\n",
- ApiResponse::createXML(['data' => ['some_data']], 'ok')
+ DI::apiResponse()->createXML(['data' => ['some_data']], 'ok')
);
}