Continued:

- added more type-hints
- added some missing documentation
This commit is contained in:
Roland Häder 2022-06-16 20:01:09 +02:00
parent a587217f47
commit 2766c7d9cf
3 changed files with 8 additions and 5 deletions

View file

@ -57,7 +57,7 @@ class Account extends BaseFactory
* @throws HTTPException\InternalServerErrorException
* @throws ImagickException|HTTPException\NotFoundException
*/
public function createFromContactId(int $contactId, $uid = 0): \Friendica\Object\Api\Mastodon\Account
public function createFromContactId(int $contactId, int $uid = 0): \Friendica\Object\Api\Mastodon\Account
{
$contact = Contact::getById($contactId, ['uri-id']);
if (empty($contact)) {
@ -74,7 +74,7 @@ class Account extends BaseFactory
* @throws HTTPException\InternalServerErrorException
* @throws ImagickException|HTTPException\NotFoundException
*/
public function createFromUriId(int $contactUriId, $uid = 0): \Friendica\Object\Api\Mastodon\Account
public function createFromUriId(int $contactUriId, int $uid = 0): \Friendica\Object\Api\Mastodon\Account
{
$account = DBA::selectFirst('account-user-view', [], ['uri-id' => $contactUriId, 'uid' => [0, $uid]], ['order' => ['id' => true]]);
if (empty($account)) {

View file

@ -70,6 +70,7 @@ class Status extends BaseFactory
/**
* @param int $uriId Uri-ID of the item
* @param int $uid Item user
* @param bool $include_entities Whether to include entities
*
* @return \Friendica\Object\Api\Twitter\Status
* @throws HTTPException\InternalServerErrorException
@ -90,12 +91,13 @@ class Status extends BaseFactory
/**
* @param int $uriId Uri-ID of the item
* @param int $uid Item user
* @param bool $include_entities Whether to include entities
*
* @return \Friendica\Object\Api\Twitter\Status
* @throws HTTPException\InternalServerErrorException
* @throws ImagickException|HTTPException\NotFoundException
*/
public function createFromUriId(int $uriId, $uid = 0, $include_entities = false): \Friendica\Object\Api\Twitter\Status
public function createFromUriId(int $uriId, int $uid = 0, bool $include_entities = false): \Friendica\Object\Api\Twitter\Status
{
$fields = ['parent-uri-id', 'uri-id', 'uid', 'author-id', 'author-link', 'author-network', 'owner-id', 'causer-id',
'starred', 'app', 'title', 'body', 'raw-body', 'created', 'network','post-reason', 'language', 'gravity',
@ -110,6 +112,7 @@ class Status extends BaseFactory
/**
* @param array $item item array
* @param int $uid Item user
* @param bool $include_entities Whether to include entities
*
* @return \Friendica\Object\Api\Twitter\Status
* @throws HTTPException\InternalServerErrorException

View file

@ -51,7 +51,7 @@ class User extends BaseFactory
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public function createFromContactId(int $contactId, $uid = 0, $skip_status = true, $include_user_entities = true)
public function createFromContactId(int $contactId, int $uid = 0, bool $skip_status = true, bool $include_user_entities = true)
{
$cdata = Contact::getPublicAndUserContactID($contactId, $uid);
if (!empty($cdata)) {
@ -78,7 +78,7 @@ class User extends BaseFactory
return new \Friendica\Object\Api\Twitter\User($publicContact, $apcontact, $userContact, $status, $include_user_entities);
}
public function createFromUserId(int $uid, $skip_status = true, $include_user_entities = true)
public function createFromUserId(int $uid, bool $skip_status = true, bool $include_user_entities = true)
{
return $this->createFromContactId(Contact::getPublicIdByUserId($uid), $uid, $skip_status, $include_user_entities);
}