Null.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Queue
  17. * @subpackage Adapter
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Queue_Adapter_AdapterAbstract
  24. */
  25. require_once 'Zend/Queue/Adapter/AdapterAbstract.php';
  26. /**
  27. * Class testing. No supported functions. Also used to disable a Zend_Queue.
  28. *
  29. * @category Zend
  30. * @package Zend_Queue
  31. * @subpackage Adapter
  32. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class Zend_Queue_Adapter_Null extends Zend_Queue_Adapter_AdapterAbstract
  36. {
  37. /**
  38. * Constructor
  39. *
  40. * @param array|Zend_Config $options
  41. * @param null|Zend_Queue $queue
  42. * @return void
  43. */
  44. public function __construct($options, Zend_Queue $queue = null)
  45. {
  46. parent::__construct($options, $queue);
  47. }
  48. /********************************************************************
  49. * Queue management functions
  50. *********************************************************************/
  51. /**
  52. * Does a queue already exist?
  53. *
  54. * @throws Zend_Queue_Exception - not supported.
  55. */
  56. public function isExists($name)
  57. {
  58. require_once 'Zend/Queue/Exception.php';
  59. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  60. }
  61. /**
  62. * Create a new queue
  63. *
  64. * @throws Zend_Queue_Exception - not supported.
  65. */
  66. public function create($name, $timeout=null)
  67. {
  68. require_once 'Zend/Queue/Exception.php';
  69. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  70. }
  71. /**
  72. * Delete a queue and all of it's messages
  73. *
  74. * @throws Zend_Queue_Exception - not supported.
  75. */
  76. public function delete($name)
  77. {
  78. require_once 'Zend/Queue/Exception.php';
  79. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  80. }
  81. /**
  82. * Get an array of all available queues
  83. *
  84. * @throws Zend_Queue_Exception - not supported.
  85. */
  86. public function getQueues()
  87. {
  88. require_once 'Zend/Queue/Exception.php';
  89. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  90. }
  91. /**
  92. * Return the approximate number of messages in the queue
  93. *
  94. * @throws Zend_Queue_Exception - not supported.
  95. */
  96. public function count(Zend_Queue $queue=null)
  97. {
  98. require_once 'Zend/Queue/Exception.php';
  99. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  100. }
  101. /********************************************************************
  102. * Messsage management functions
  103. *********************************************************************/
  104. /**
  105. * Send a message to the queue
  106. *
  107. * @throws Zend_Queue_Exception - not supported.
  108. */
  109. public function send($message, Zend_Queue $queue=null)
  110. {
  111. require_once 'Zend/Queue/Exception.php';
  112. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  113. }
  114. /**
  115. * Get messages in the queue
  116. *
  117. * @throws Zend_Queue_Exception - not supported.
  118. */
  119. public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null)
  120. {
  121. require_once 'Zend/Queue/Exception.php';
  122. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  123. }
  124. /**
  125. * Delete a message from the queue
  126. *
  127. * @throws Zend_Queue_Exception - not supported.
  128. */
  129. public function deleteMessage(Zend_Queue_Message $message)
  130. {
  131. require_once 'Zend/Queue/Exception.php';
  132. throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
  133. }
  134. /********************************************************************
  135. * Supporting functions
  136. *********************************************************************/
  137. /**
  138. * Return a list of queue capabilities functions
  139. *
  140. * $array['function name'] = true or false
  141. * true is supported, false is not supported.
  142. *
  143. * @param string $name
  144. * @return array
  145. */
  146. public function getCapabilities()
  147. {
  148. return array(
  149. 'create' => false,
  150. 'delete' => false,
  151. 'send' => false,
  152. 'receive' => false,
  153. 'deleteMessage' => false,
  154. 'getQueues' => false,
  155. 'count' => false,
  156. 'isExists' => false,
  157. );
  158. }
  159. }