mirror of
https://github.com/friendica/friendica
synced 2024-12-23 04:00:15 +00:00
Changes:
- added some missing type-hints - added some documentation - added some empty lines to `@return` statements (code-style convention)
This commit is contained in:
parent
33c7abd376
commit
074bae33c9
12 changed files with 30 additions and 5 deletions
|
@ -41,7 +41,6 @@ class Application extends BaseFactory
|
|||
* @param int $id Application ID
|
||||
*
|
||||
* @return \Friendica\Object\Api\Mastodon\Application
|
||||
*
|
||||
* @throws UnprocessableEntityException
|
||||
*/
|
||||
public function createFromApplicationId(int $id): \Friendica\Object\Api\Mastodon\Application
|
||||
|
|
|
@ -33,6 +33,7 @@ class Emoji extends BaseFactory
|
|||
|
||||
/**
|
||||
* @param array $smilies
|
||||
*
|
||||
* @return Emojis
|
||||
*/
|
||||
public function createCollectionFromSmilies(array $smilies): Emojis
|
||||
|
|
|
@ -43,6 +43,7 @@ class Field extends BaseFactory
|
|||
|
||||
/**
|
||||
* @param ProfileFields $profileFields
|
||||
*
|
||||
* @return Fields
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
|
@ -45,6 +45,12 @@ class Notification extends BaseFactory
|
|||
$this->mstdnStatusFactory = $mstdnStatusFactoryFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Notifications\Entity\Notification $Notification
|
||||
*
|
||||
* @return MstdnNotification
|
||||
* @throws UnexpectedNotificationTypeException
|
||||
*/
|
||||
public function createFromNotification(Notifications\Entity\Notification $Notification): MstdnNotification
|
||||
{
|
||||
$type = self::getType($Notification);
|
||||
|
|
|
@ -31,8 +31,11 @@ class Poll extends BaseFactory
|
|||
/**
|
||||
* @param int $id Id the question
|
||||
* @param int $uid Item user
|
||||
*
|
||||
* @return \Friendica\Object\Api\Mastodon\Poll
|
||||
* @throws HTTPException\NotFoundException
|
||||
*/
|
||||
public function createFromId(int $id, $uid = 0): \Friendica\Object\Api\Mastodon\Poll
|
||||
public function createFromId(int $id, int $uid = 0): \Friendica\Object\Api\Mastodon\Poll
|
||||
{
|
||||
$question = Post\Question::getById($id);
|
||||
if (empty($question)) {
|
||||
|
|
|
@ -31,6 +31,7 @@ class Relationship extends BaseFactory
|
|||
/**
|
||||
* @param int $contactId Contact ID (public or user contact)
|
||||
* @param int $uid User ID
|
||||
*
|
||||
* @return RelationshipEntity
|
||||
* @throws Exception
|
||||
*/
|
||||
|
|
|
@ -78,7 +78,7 @@ class Status extends BaseFactory
|
|||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws ImagickException|HTTPException\NotFoundException
|
||||
*/
|
||||
public function createFromUriId(int $uriId, $uid = 0): \Friendica\Object\Api\Mastodon\Status
|
||||
public function createFromUriId(int $uriId, int $uid = 0): \Friendica\Object\Api\Mastodon\Status
|
||||
{
|
||||
$fields = ['uri-id', 'uid', 'author-id', 'author-uri-id', 'author-link', 'starred', 'app', 'title', 'body', 'raw-body', 'content-warning', 'question-id',
|
||||
'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity', 'featured', 'has-media'];
|
||||
|
|
|
@ -41,6 +41,7 @@ class Tag extends BaseFactory
|
|||
|
||||
/**
|
||||
* @param int $uriId Uri-ID of the item
|
||||
*
|
||||
* @return array
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
|
@ -35,6 +35,7 @@ class Attachment extends BaseFactory
|
|||
|
||||
/**
|
||||
* @param int $uriId Uri-ID of the attachments
|
||||
*
|
||||
* @return array
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
|
@ -35,6 +35,8 @@ class Hashtag extends BaseFactory
|
|||
|
||||
/**
|
||||
* @param int $uriId Uri-ID of the attachments
|
||||
* @param string $text
|
||||
*
|
||||
* @return array
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,8 @@ class Media extends BaseFactory
|
|||
|
||||
/**
|
||||
* @param int $uriId Uri-ID of the attachments
|
||||
* @param string $text
|
||||
*
|
||||
* @return array
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
|
|
|
@ -47,11 +47,12 @@ class User extends BaseFactory
|
|||
* @param int $uid Public contact (=0) or owner user id
|
||||
* @param bool $skip_status
|
||||
* @param bool $include_user_entities
|
||||
*
|
||||
* @return \Friendica\Object\Api\Twitter\User
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
public function createFromContactId(int $contactId, int $uid = 0, bool $skip_status = true, bool $include_user_entities = true)
|
||||
public function createFromContactId(int $contactId, int $uid = 0, bool $skip_status = true, bool $include_user_entities = true): \Friendica\Object\Api\Twitter\User
|
||||
{
|
||||
$cdata = Contact::getPublicAndUserContactID($contactId, $uid);
|
||||
if (!empty($cdata)) {
|
||||
|
@ -78,7 +79,14 @@ class User extends BaseFactory
|
|||
return new \Friendica\Object\Api\Twitter\User($publicContact, $apcontact, $userContact, $status, $include_user_entities);
|
||||
}
|
||||
|
||||
public function createFromUserId(int $uid, bool $skip_status = true, bool $include_user_entities = true)
|
||||
/**
|
||||
* @param int $uid Public contact (=0) or owner user id
|
||||
* @param bool $skip_status
|
||||
* @param bool $include_user_entities
|
||||
*
|
||||
* @return \Friendica\Object\Api\Twitter\User
|
||||
*/
|
||||
public function createFromUserId(int $uid, bool $skip_status = true, bool $include_user_entities = true): \Friendica\Object\Api\Twitter\User
|
||||
{
|
||||
return $this->createFromContactId(Contact::getPublicIdByUserId($uid), $uid, $skip_status, $include_user_entities);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue