mirror of
https://github.com/friendica/friendica
synced 2025-04-19 11:10:10 +00:00
Transform ApiResponse::exit() into dynamic method
This commit is contained in:
parent
4309f814e0
commit
ea0f41ecf0
13 changed files with 27 additions and 30 deletions
|
@ -145,7 +145,7 @@ class ApiResponse
|
|||
|
||||
header(($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1') . ' ' . $code . ' ' . $description);
|
||||
|
||||
self::exit('status', ['status' => $error], $format);
|
||||
DI::apiResponse()->exit('status', ['status' => $error], $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,11 +157,11 @@ class ApiResponse
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function exit(string $root_element, array $data, string $format = null)
|
||||
public function exit(string $root_element, array $data, string $format = null)
|
||||
{
|
||||
$format = $format ?? 'json';
|
||||
|
||||
$return = DI::apiResponse()->formatData($root_element, $format, $data);
|
||||
$return = $this->formatData($root_element, $format, $data);
|
||||
|
||||
switch ($format) {
|
||||
case 'xml':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue