* @property-read string $user_agent
* @property-read bool $trusted
* @property-read string|null $last_used
+ * @property-read string $guid
+ * @property-read string $addr
+ * @property-read UriInterface $alias
+ * @property-read string $nick
+ * @property-read string $givenName
+ * @property-read string $familyName
+ * @property-read UriInterface $photoMedium
+ * @property-read UriInterface $photoSmall
+ * @property-read UriInterface $batch
+ * @property-read UriInterface $notify
+ * @property-read UriInterface $poll
+ * @property-read string $subscribe
+ * @property-read bool $searchable
+ * @property-read string $pubKey
+ * @property-read UriInterface $baseurl
+ * @property-read int $gsid
+ * @property-read \DateTime $updated
+ * @property-read int $interacting_count
+ * @property-read int $interacted_count
+ * @property-read int $post_count
*/
abstract class BaseEntity extends BaseDataTransferObject
{
* @param integer $page Page number
* @param integer $max_id Maximum ID
* @param string $requester URL of requesting account
- * @param boolean $nocache Wether to bypass caching
* @return array of posts
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
/**
* Set the worker id for the queue entry
*
- * @param array $activity
- * @param int $wid
* @return void
*/
public static function setWorkerId(string $url, int $wid)
/**
* Check if there is an assigned worker task
- *
- * @param array $activity
- * @return bool
*/
public static function hasWorker(string $url): bool
{
* @return int|bool New mail table row id or false on error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- private static function postMail(array $item): bool
+ private static function postMail(array $item)
{
if (($item['gravity'] != Item::GRAVITY_PARENT) && !DBA::exists('mail', ['uri' => $item['thr-parent'], 'uid' => $item['uid']])) {
Logger::info('Parent not found, mail will be discarded.', ['uid' => $item['uid'], 'uri' => $item['thr-parent']]);
use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\Contact;
-use Friendica\Model\GServer;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Post;
/**
* Get a list of receivers for the provided uri-id
- *
- * @param array $item
- * @param boolean $blindcopy
- * @return array
*/
public static function getReceiversForUriId(int $uri_id, bool $blindcopy): array
{
/**
* Creates an activity array for a given URI-Id and uid
*
- * @param integer $uri_id
- * @param integer $uid
* @param boolean $object_mode true = Create the object, false = create the activity with the object
* @param boolean $api_mode true = used for the API
* @param boolean $announce_activity true = the announced object is the activity, false = we announce the object link
/**
* Creates an activity array for a given item id
*
- * @param integer $item_id
* @param boolean $object_mode true = Create the object, false = create the activity with the object
* @param boolean $api_mode true = used for the API
* @param boolean $announce_activity true = the announced object is the activity, false = we announce the object link
* Prepends mentions (@) to $body variable
*
* @param string $body HTML code
- * @param int $uriId
* @param string $authorLink Author link
* @return string HTML code with prepended mentions
*/
- private static function prependMentions(string $body, int $uriid, string $authorLink): string
+ private static function prependMentions(string $body, int $uriId, string $authorLink): string
{
$mentions = [];
- foreach (Tag::getByURIId($uriid, [Tag::IMPLICIT_MENTION]) as $tag) {
+ foreach (Tag::getByURIId($uriId, [Tag::IMPLICIT_MENTION]) as $tag) {
$profile = Contact::getByURL($tag['url'], false, ['addr', 'contact-type', 'nick']);
if (
!empty($profile['addr'])
$t_dob = strtotime($bd);
$now = strtotime(DateTimeFormat::timezoneNow($tz));
if ($t_dob < $now) {
- $bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
+ $bd = (int) $y + 1 . '-' . $tmp_dob . ' 00:00';
}
$birthday = DateTimeFormat::convert($bd, 'UTC', $tz, DateTimeFormat::ATOM);
}
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
use Friendica\Network\HTTPException;
+use Friendica\Network\HTTPException\InternalServerErrorException;
+use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Network\Probe;
use Friendica\Protocol\Delivery;
use Friendica\Util\Crypto;
* @param WebFingerUri $uri The handle
*
* @return string The public key
- * @throws InternalServerErrorException
+ * @throws NotFoundException
* @throws \ImagickException
*/
private static function key(WebFingerUri $uri): string
Logger::info('Fetching diaspora key', ['handle' => $uri->getAddr()]);
try {
return DI::dsprContact()->getByAddr($uri)->pubKey;
- } catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
+ } catch (NotFoundException | \InvalidArgumentException $e) {
return '';
}
}
* @param string $url profile url or WebFinger address
* @param boolean|null $update true = always update, false = never update, null = update when not found or outdated
* @return boolean
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @throws InternalServerErrorException
* @throws \ImagickException
*/
public static function isSupportedByContactUrl(string $url, ?bool $update = null): bool
/**
* Transmit a message to a target server
*
- * @param array $owner the array of the item owner
* @param array $contact Target of the communication
* @param string $envelope The message that is to be transmitted
* @param bool $public_batch Is it a public post?
* @param string $guid message guid
*
* @return int Result of the transmission
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @throws InternalServerErrorException
* @throws \ImagickException
*/
private static function transmit(array $contact, string $envelope, bool $public_batch, string $guid = ''): int
/**
* Create an event array
*
- * @param integer $event_id The id of the event
+ * @param string $event_id The id of the event
*
* @return array with event data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
use Psr\Http\Message\UriInterface;
/**
- * @property-read $uriId
- * @property-read $url
- * @property-read $guid
- * @property-read $addr
- * @property-read $alias
- * @property-read $nick
- * @property-read $name
- * @property-read $givenName
- * @property-read $familyName
- * @property-read $photo
- * @property-read $photoMedium
- * @property-read $photoSmall
- * @property-read $batch
- * @property-read $notify
- * @property-read $poll
- * @property-read $subscribe
- * @property-read $searchable
- * @property-read $pubKey
- * @property-read $baseurl
- * @property-read $gsid
- * @property-read $created
- * @property-read $updated
- * @property-read $interacting_count
- * @property-read $interacted_count
- * @property-read $post_count
+ * @property-read int $uriId
+ * @property-read UriInterface $url
+ * @property-read string $guid
+ * @property-read string $addr
+ * @property-read UriInterface $alias
+ * @property-read string $nick
+ * @property-read string $name
+ * @property-read string $givenName
+ * @property-read string $familyName
+ * @property-read UriInterface $photo
+ * @property-read UriInterface $photoMedium
+ * @property-read UriInterface $photoSmall
+ * @property-read UriInterface $batch
+ * @property-read UriInterface $notify
+ * @property-read UriInterface $poll
+ * @property-read string $subscribe
+ * @property-read bool $searchable
+ * @property-read string $pubKey
+ * @property-read UriInterface $baseurl
+ * @property-read int $gsid
+ * @property-read \DateTime $created
+ * @property-read \DateTime $updated
+ * @property-read int $interacting_count
+ * @property-read int $interacted_count
+ * @property-read int $post_count
*/
class DiasporaContact extends \Friendica\BaseEntity
{
/**
* get a url (scheme://domain.tld/u/user) from a given contact guid
*
- * @param mixed $guid Hexadecimal string guid
+ * @param string $guid Hexadecimal string guid
*
* @return string the contact url or null
* @throws \Exception
use Friendica\Core\Protocol;
use Friendica\Model\Item;
use Friendica\Util\Strings;
-use \IMAP\Connection;
+use IMAP\Connection;
/**
* Email class
* @param string $mailbox The mailbox name
* @param string $username The username
* @param string $password The password
- * @return Connection|false
+ * @return Connection|resource|false
* @throws \Exception
*/
public static function connect(string $mailbox, string $username, string $password)
/**
* @param Connection|resource $mbox mailbox
* @param string $email_addr email
- * @return array
* @throws \Exception
*/
public static function poll($mbox, string $email_addr): array