PageRenderTime 43ms CodeModel.GetById 4ms RepoModel.GetById 0ms app.codeStats 0ms

/webapp/_lib/model/interface.FollowDAO.php

http://github.com/ginatrapani/ThinkUp
PHP | 254 lines | 27 code | 24 blank | 203 comment | 0 complexity | 1d78ce53cf3d1f22a7e59f4ca54d00d8 MD5 | raw file
Possible License(s): Apache-2.0, GPL-2.0, GPL-3.0, LGPL-2.1
  1. <?php
  2. /**
  3. *
  4. * ThinkUp/webapp/_lib/model/interface.FollowDAO.php
  5. *
  6. * Copyright (c) 2009-2012 Gina Trapani, Christoffer Viken
  7. *
  8. * LICENSE:
  9. *
  10. * This file is part of ThinkUp (http://thinkupapp.com).
  11. *
  12. * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
  13. * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
  14. * later version.
  15. *
  16. * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
  17. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18. * details.
  19. *
  20. * You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
  21. * <http://www.gnu.org/licenses/>.
  22. *
  23. *
  24. * Follow Data Access Object Interface
  25. *
  26. * @license http://www.gnu.org/licenses/gpl.html
  27. * @copyright 2009-2012 Gina Trapani, Christoffer Viken
  28. * @author Gina Trapani <ginatrapani[at]gmail[dot]com>
  29. * @author Christoffer Viken <christoffer[at]viken[dot]me>
  30. */
  31. interface FollowDAO {
  32. /**
  33. * Checks whether a given 'follow' exist in storage.
  34. * @param int $user_id
  35. * @param int $follower_id
  36. * @param str $network
  37. * @param bool $is_active Whether or not relationship should be active only
  38. * @return bool true if follow exists
  39. */
  40. public function followExists($user_id, $follower_id, $network, $is_active=false);
  41. /**
  42. * Updates 'last seen' in storage.
  43. * @param int $user_id
  44. * @param int $follower_id
  45. * @param str $network
  46. * @param string $debug_api_call
  47. * @return int update count
  48. */
  49. public function update($user_id, $follower_id, $network, $debug_api_call = '');
  50. /**
  51. * Deactivates a 'follow' in storage.
  52. * @param int $user_id
  53. * @param int $follower_id
  54. * @param str $network
  55. * @param string $debug_api_call
  56. * @return int update count
  57. */
  58. public function deactivate($user_id, $follower_id, $network, $debug_api_call = '');
  59. /**
  60. * Adds a 'follow' to storage
  61. * @param int $user_id
  62. * @param int $follower_id
  63. * @param str $network
  64. * @param string $debug_api_call
  65. * @return int insert count
  66. */
  67. public function insert($user_id, $follower_id, $network, $debug_api_call = '');
  68. /**
  69. * Gets the number of follow(ers) with errors for a given user
  70. * @param int $user_id
  71. * @param str $network
  72. * @return int with the number
  73. */
  74. public function countTotalFollowsWithErrors($user_id, $network);
  75. /**
  76. * Gets the number of friends with errors for a given user.
  77. * @param int $user_id
  78. * @param str $network
  79. * @return int with the number
  80. */
  81. public function countTotalFriendsWithErrors($user_id, $network);
  82. /**
  83. * Gets the number of follows that have full datails.
  84. * @param int $user_id
  85. * @param str $network
  86. * @return int with the number
  87. */
  88. public function countTotalFollowsWithFullDetails($user_id, $network);
  89. /**
  90. * Gets the number of follows that are protected.
  91. * Includes inactive friendships in count.
  92. * @param int $user_id
  93. * @param str $network
  94. * @return int with the number
  95. */
  96. public function countTotalFollowsProtected($user_id, $network);
  97. /**
  98. * Count the total number of friends in storage related to a user.
  99. * Originally counts all the friends, also the inactive ones,
  100. * this may be a subject to change.
  101. * @param int $user_id
  102. * @param str $network
  103. * @return int with the number
  104. */
  105. public function countTotalFriends($user_id, $network);
  106. /**
  107. * Gets the number of friends that is protected.
  108. * Includes inactive friendships in count.
  109. * @param int $user_id
  110. * @param str $network
  111. * @return int Total protected friends
  112. */
  113. public function countTotalFriendsProtected($user_id, $network);
  114. /**
  115. * Get a list of, friends without details in storage.
  116. * @param int $user_id
  117. * @param str $network
  118. * @return array Numbered keys, with arrays - named keys
  119. */
  120. public function getUnloadedFollowerDetails($user_id, $network);
  121. /**
  122. * Get the friend updated the longest time ago, if age is more than 1 day.
  123. * @param int $user_id
  124. * @param str $network
  125. * @return User object
  126. */
  127. public function getStalestFriend($user_id, $network);
  128. /**
  129. * Gets the person in storage seen the longest time ago.
  130. * @param str $network
  131. * @return array Named keys
  132. */
  133. public function getOldestFollow($network);
  134. /**
  135. * Gets the followers with most followers.
  136. * @param int $user_id
  137. * @param str $network
  138. * @param int $count
  139. * @return array Numbered keys, with arrays - named keys
  140. */
  141. public function getMostFollowedFollowers($user_id, $network, $count = 20, $page = 1);
  142. /**
  143. * Gets the followers with highest follower:friend count.
  144. * @param int $user_id
  145. * @param str $network
  146. * @param int $count
  147. * @param int $page defaults to 1
  148. * @return array - numbered keys, with arrays - named keys
  149. */
  150. public function getLeastLikelyFollowers($user_id, $network, $count = 20, $page = 1);
  151. /**
  152. * Gets the followers with highest follower:friend count first seen by ThinkUp in the past 7 days.
  153. * @param int $user_id
  154. * @param str $network
  155. * @param int $count
  156. * @param int $page defaults to 1
  157. * @return array - numbered keys, with arrays - named keys
  158. */
  159. public function getLeastLikelyFollowersThisWeek($user_id, $network, $count = 20, $page = 1);
  160. /**
  161. * Gets the followers with the earliest join date.
  162. * @param int $user_id
  163. * @param str $network
  164. * @param int $count
  165. * @param int $page defaults to 1
  166. * @return array - numbered keys, with arrays - named keys
  167. */
  168. public function getEarliestJoinerFollowers($user_id, $network, $count = 20, $page = 1);
  169. /**
  170. * Gets the friends with the highest tweet per day count.
  171. * @param int $user_id
  172. * @param str $network
  173. * @param int $count
  174. * @param int $page defaults to 1
  175. * @return array - numbered keys, with arrays - named keys
  176. */
  177. public function getMostActiveFollowees($user_id, $network, $count = 20, $page = 1);
  178. /**
  179. * Gets a list of inactive friends.
  180. * @param int $user_id
  181. * @param str $network
  182. * @param int $count
  183. * @param int $page defaults to 1
  184. * @return array - numbered keys, with arrays - named keys
  185. */
  186. public function getFormerFollowees($user_id, $network, $count = 20, $page = 1);
  187. /**
  188. * Gets a list of inactive followers.
  189. * @param int $user_id
  190. * @param str $network
  191. * @param int $count
  192. * @param int $page defaults to 1
  193. * @return array - numbered keys, with arrays - named keys
  194. */
  195. public function getFormerFollowers($user_id, $network, $count = 20, $page = 1);
  196. /**
  197. * Gets the followers with the lowest tweet-per-day ratio.
  198. * @param int $user_id
  199. * @param str $network
  200. * @param int $count
  201. * @param int $page defaults to 1
  202. * @return array - numbered keys, with arrays - named keys
  203. */
  204. public function getLeastActiveFollowees($user_id, $network, $count = 20, $page = 1);
  205. /**
  206. * Gets the friends with the most followers
  207. * @param int $user_id
  208. * @param str $network
  209. * @param int $count
  210. * @param int $page defaults to 1
  211. * @return array - numbered keys, with arrays - named keys
  212. */
  213. public function getMostFollowedFollowees($user_id, $network, $count = 20, $page = 1);
  214. /**
  215. * Gets friends that the two inputed user IDs both follow.
  216. * @param int $uid
  217. * @param int $instance_uid
  218. * @param str $network
  219. * @param int $page defaults to 1
  220. * @return array - numbered keys, with arrays - named keys
  221. */
  222. public function getMutualFriends($uid, $instance_uid, $network);
  223. /**
  224. * Gets the friends that do not follow you back.
  225. * @param int $uid
  226. * @param str $network
  227. * @return array - numbered keys, with arrays - named keys
  228. */
  229. public function getFriendsNotFollowingBack($uid, $network);
  230. }