mirror of
https://github.com/friendica/friendica
synced 2025-04-19 05:50:10 +00:00
Changes:
- added missing type-hints - added documentation - removed parameter $baseURL while it can be locally get the same way but lesser parameter - used ActivityNamespace::SALMON_ME - changed double-quotes to single
This commit is contained in:
parent
074bae33c9
commit
cfa575b8e5
10 changed files with 71 additions and 35 deletions
|
@ -109,7 +109,7 @@ class ApiResponse extends Response
|
|||
* @param int $cid Contact ID of template
|
||||
* @return array
|
||||
*/
|
||||
private function addRSSValues(array $arr, int $cid)
|
||||
private function addRSSValues(array $arr, int $cid): array
|
||||
{
|
||||
if (empty($cid)) {
|
||||
return $arr;
|
||||
|
@ -244,6 +244,8 @@ class ApiResponse extends Response
|
|||
* Wrapper around exit() for JSON only responses
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exitWithJson(array $data)
|
||||
{
|
||||
|
|
|
@ -68,10 +68,11 @@ class Show extends BaseApi
|
|||
/**
|
||||
* @param array $profile_row array containing data from db table 'profile'
|
||||
* @param ProfileFields $profileFields
|
||||
*
|
||||
* @return array
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function formatProfile($profile_row, ProfileFields $profileFields)
|
||||
private static function formatProfile($profile_row, ProfileFields $profileFields): array
|
||||
{
|
||||
$custom_fields = [];
|
||||
foreach ($profileFields as $profileField) {
|
||||
|
|
|
@ -95,7 +95,7 @@ abstract class ContactEndpoint extends BaseApi
|
|||
* @throws HTTPException\NotFoundException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
protected static function list(array $ids, int $total_count, int $uid, int $cursor = -1, int $count = self::DEFAULT_COUNT, bool $skip_status = false, bool $include_user_entities = true)
|
||||
protected static function list(array $ids, int $total_count, int $uid, int $cursor = -1, int $count = self::DEFAULT_COUNT, bool $skip_status = false, bool $include_user_entities = true): array
|
||||
{
|
||||
$return = self::ids($ids, $total_count, $cursor, $count, false);
|
||||
|
||||
|
@ -128,7 +128,7 @@ abstract class ContactEndpoint extends BaseApi
|
|||
* @return array
|
||||
* @throws HTTPException\NotFoundException
|
||||
*/
|
||||
protected static function ids(array $ids, int $total_count, int $cursor = -1, int $count = self::DEFAULT_COUNT, bool $stringify_ids = false)
|
||||
protected static function ids(array $ids, int $total_count, int $cursor = -1, int $count = self::DEFAULT_COUNT, bool $stringify_ids = false): array
|
||||
{
|
||||
$next_cursor = 0;
|
||||
$previous_cursor = 0;
|
||||
|
|
|
@ -54,6 +54,8 @@ abstract class DirectMessagesEndpoint extends BaseApi
|
|||
* @param array $request
|
||||
* @param int $uid
|
||||
* @param array $condition
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function getMessages(array $request, int $uid, array $condition)
|
||||
{
|
||||
|
|
|
@ -102,9 +102,9 @@ class Xrd extends BaseModule
|
|||
}
|
||||
|
||||
if ($mode == Response::TYPE_XML) {
|
||||
self::printXML($alias, DI::baseUrl()->get(), $user, $owner, $avatar);
|
||||
self::printXML($alias, $user, $owner, $avatar);
|
||||
} else {
|
||||
self::printJSON($alias, DI::baseUrl()->get(), $owner, $avatar);
|
||||
self::printJSON($alias, $owner, $avatar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,8 +153,9 @@ class Xrd extends BaseModule
|
|||
System::jsonExit($json, 'application/jrd+json; charset=utf-8');
|
||||
}
|
||||
|
||||
private static function printJSON($alias, $baseURL, $owner, $avatar)
|
||||
private static function printJSON(string $alias, array $owner, array $avatar)
|
||||
{
|
||||
$baseURL = DI::baseUrl()->get();
|
||||
$salmon_key = Salmon::salmonKey($owner['spubkey']);
|
||||
|
||||
$json = [
|
||||
|
@ -234,8 +235,9 @@ class Xrd extends BaseModule
|
|||
System::jsonExit($json, 'application/jrd+json; charset=utf-8');
|
||||
}
|
||||
|
||||
private static function printXML($alias, $baseURL, $user, $owner, $avatar)
|
||||
private static function printXML(string $alias, array $user, array $owner, array $avatar)
|
||||
{
|
||||
$baseURL = DI::baseUrl()->get();
|
||||
$salmon_key = Salmon::salmonKey($owner['spubkey']);
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('xrd_person.tpl');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue