+ /**
+ * @param integer $id
+ * @return array|boolean Contact record if it exists, false otherwise
+ * @throws \Exception
+ */
+ public static function getById($id)
+ {
+ return DBA::selectFirst('contact', [], ['id' => $id]);
+ }
+
+ /**
+ * @brief Tests if the given contact is a follower
+ *
+ * @param int $cid Either public contact id or user's contact id
+ * @param int $uid User ID
+ *
+ * @return boolean is the contact id a follower?
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @throws \ImagickException
+ */
+ public static function isFollower($cid, $uid)
+ {
+ if (self::isBlockedByUser($cid, $uid)) {
+ return false;
+ }
+
+ $cdata = self::getPublicAndUserContacID($cid, $uid);
+ if (empty($cdata['user'])) {
+ return false;
+ }
+
+ $condition = ['id' => $cdata['user'], 'rel' => [self::FOLLOWER, self::FRIEND]];
+ return DBA::exists('contact', $condition);
+ }
+