* @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);
* @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:
/**
* 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]);
/**
* 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]);
/**
* Ensure that cached avatar exist
*
- * @param integer $cid
+ * @param integer $cid Contact id
*/
public static function checkAvatarCache(int $cid)
{
* @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);
* @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);
}
* @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);
}
* @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);
}
* @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 = [];
* @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:
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function updateFromProbeByURL($url)
+ public static function updateFromProbeByURL(string $url): int
{
$id = self::getIdForURL($url);
* @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;
* 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
*/