X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FContact.php;h=f8ff91ec554112f4a4a19559f16b4e94ca8369b1;hb=f12cc9648ecf2bdd0e468e29be4164a844b96a46;hp=aea3faf3cdcb60aa7ced2e3437d62632fa97608d;hpb=7560dccc088ff15980dcdf7f6db09b38980bd3d1;p=friendica.git diff --git a/src/Model/Contact.php b/src/Model/Contact.php index aea3faf3cd..f8ff91ec55 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -128,10 +128,10 @@ class Contact * @param array $fields Array of selected fields, empty for all * @param array $condition Array of fields for condition * @param array $params Array of several parameters - * @return array + * @return array|bool * @throws \Exception */ - public static function selectFirst(array $fields = [], array $condition = [], array $params = []): array + public static function selectFirst(array $fields = [], array $condition = [], array $params = []) { $contact = DBA::selectFirst('contact', $fields, $condition, $params); @@ -1527,7 +1527,7 @@ class Contact * @param int $type type of contact or account * @return string */ - public static function getAccountType(int $type) + public static function getAccountType(int $type): string { switch ($type) { case self::TYPE_ORGANISATION: @@ -1553,11 +1553,11 @@ class Contact /** * Blocks a contact * - * @param int $cid - * @return bool - * @throws \Exception + * @param int $cid Contact id to block + * @param string $reason Block reason + * @return bool Whether it was successful */ - public static function block($cid, $reason = null) + public static function block(int $cid, string $reason = null): bool { $return = self::update(['blocked' => true, 'block_reason' => $reason], ['id' => $cid]); @@ -1567,11 +1567,10 @@ class Contact /** * Unblocks a contact * - * @param int $cid - * @return bool - * @throws \Exception + * @param int $cid Contact id to unblock + * @return bool Whether it was successfull */ - public static function unblock($cid) + public static function unblock(int $cid): bool { $return = self::update(['blocked' => false, 'block_reason' => null], ['id' => $cid]); @@ -1581,7 +1580,7 @@ class Contact /** * Ensure that cached avatar exist * - * @param integer $cid + * @param integer $cid Contact id */ public static function checkAvatarCache(int $cid) { @@ -1621,7 +1620,7 @@ class Contact * @param bool $no_update Don't perfom an update if no cached avatar was found * @return string photo path */ - private static function getAvatarPath(array $contact, string $size, $no_update = false) + private static function getAvatarPath(array $contact, string $size, bool $no_update = false): string { $contact = self::checkAvatarCacheByArray($contact, $no_update); @@ -1655,7 +1654,7 @@ class Contact * @param bool $no_update Don't perfom an update if no cached avatar was found * @return string photo path */ - public static function getPhoto(array $contact, bool $no_update = false) + public static function getPhoto(array $contact, bool $no_update = false): string { return self::getAvatarPath($contact, Proxy::SIZE_SMALL, $no_update); } @@ -1667,7 +1666,7 @@ class Contact * @param bool $no_update Don't perfom an update if no cached avatar was found * @return string photo path */ - public static function getThumb(array $contact, bool $no_update = false) + public static function getThumb(array $contact, bool $no_update = false): string { return self::getAvatarPath($contact, Proxy::SIZE_THUMB, $no_update); } @@ -1679,7 +1678,7 @@ class Contact * @param bool $no_update Don't perfom an update if no cached avatar was found * @return string photo path */ - public static function getMicro(array $contact, bool $no_update = false) + public static function getMicro(array $contact, bool $no_update = false): string { return self::getAvatarPath($contact, Proxy::SIZE_MICRO, $no_update); } @@ -1691,7 +1690,7 @@ class Contact * @param bool $no_update Don't perfom an update if no cached avatar was found * @return array contact array with avatar cache fields */ - private static function checkAvatarCacheByArray(array $contact, bool $no_update = false) + private static function checkAvatarCacheByArray(array $contact, bool $no_update = false): array { $update = false; $contact_fields = []; @@ -1797,7 +1796,7 @@ class Contact * @param string $size Size of the avatar picture * @return string avatar URL */ - public static function getDefaultAvatar(array $contact, string $size) + public static function getDefaultAvatar(array $contact, string $size): string { switch ($size) { case Proxy::SIZE_MICRO: @@ -2558,7 +2557,7 @@ class Contact * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ - public static function updateFromProbeByURL($url) + public static function updateFromProbeByURL(string $url): int { $id = self::getIdForURL($url); @@ -2579,7 +2578,7 @@ class Contact * @param string $network Network of that contact * @return string with protocol */ - public static function getProtocol($url, $network) + public static function getProtocol(string $url, string $network): string { if ($network != Protocol::DFRN) { return $network; @@ -2946,6 +2945,7 @@ class Contact * Update the local relationship when a local user loses a follower * * @param array $contact User-specific contact (uid != 0) array + * @return void * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */