abstract.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. /**
  3. * ZeroBin
  4. *
  5. * a zero-knowledge paste bin
  6. *
  7. * @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
  8. * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
  9. * @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
  10. * @version 0.19
  11. */
  12. /**
  13. * zerobin_abstract
  14. *
  15. * Abstract model for ZeroBin data access, implemented as a singleton.
  16. */
  17. abstract class zerobin_abstract
  18. {
  19. /**
  20. * singleton instance
  21. *
  22. * @access protected
  23. * @static
  24. * @var zerobin
  25. */
  26. protected static $_instance = null;
  27. /**
  28. * enforce singleton, disable constructor
  29. *
  30. * Instantiate using {@link getInstance()}, zerobin is a singleton object.
  31. *
  32. * @access protected
  33. */
  34. protected function __construct() {}
  35. /**
  36. * enforce singleton, disable cloning
  37. *
  38. * Instantiate using {@link getInstance()}, zerobin is a singleton object.
  39. *
  40. * @access private
  41. */
  42. private function __clone() {}
  43. /**
  44. * get instance of singleton
  45. *
  46. * @access public
  47. * @static
  48. * @param array $options
  49. * @return zerobin_abstract
  50. */
  51. public static function getInstance($options) {}
  52. /**
  53. * Create a paste.
  54. *
  55. * @access public
  56. * @param string $pasteid
  57. * @param array $paste
  58. * @return int|false
  59. */
  60. abstract public function create($pasteid, $paste);
  61. /**
  62. * Read a paste.
  63. *
  64. * @access public
  65. * @param string $pasteid
  66. * @return string
  67. */
  68. abstract public function read($pasteid);
  69. /**
  70. * Delete a paste and its discussion.
  71. *
  72. * @access public
  73. * @param string $pasteid
  74. * @return void
  75. */
  76. abstract public function delete($pasteid);
  77. /**
  78. * Test if a paste exists.
  79. *
  80. * @access public
  81. * @param string $dataid
  82. * @return void
  83. */
  84. abstract public function exists($pasteid);
  85. /**
  86. * Create a comment in a paste.
  87. *
  88. * @access public
  89. * @param string $pasteid
  90. * @param string $parentid
  91. * @param string $commentid
  92. * @param array $comment
  93. * @return int|false
  94. */
  95. abstract public function createComment($pasteid, $parentid, $commentid, $comment);
  96. /**
  97. * Read all comments of paste.
  98. *
  99. * @access public
  100. * @param string $pasteid
  101. * @return array
  102. */
  103. abstract public function readComments($pasteid);
  104. /**
  105. * Test if a comment exists.
  106. *
  107. * @access public
  108. * @param string $dataid
  109. * @param string $parentid
  110. * @param string $commentid
  111. * @return void
  112. */
  113. abstract public function existsComment($pasteid, $parentid, $commentid);
  114. }