+ /**
+ * Follow a contact
+ *
+ * @param int $cid Public contact id
+ * @param int $uid User ID
+ *
+ * @return bool "true" if following had been successful
+ */
+ public static function follow(int $cid, int $uid)
+ {
+ $user = User::getById($uid);
+ if (empty($user)) {
+ return false;
+ }
+
+ $contact = self::getById($cid, ['url']);
+
+ $result = self::createFromProbe($user, $contact['url'], false);
+
+ return $result['cid'];
+ }
+
+ /**
+ * Unfollow a contact
+ *
+ * @param int $cid Public contact id
+ * @param int $uid User ID
+ *
+ * @return bool "true" if unfollowing had been successful
+ */
+ public static function unfollow(int $cid, int $uid)
+ {
+ $cdata = self::getPublicAndUserContacID($cid, $uid);
+ if (empty($cdata['user'])) {
+ return false;
+ }
+
+ $contact = self::getById($cdata['user']);
+
+ self::removeSharer([], $contact);
+
+ return true;
+ }
+