File indexing completed on 2025-01-19 05:21:24

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Queue
0017  * @subpackage Adapter
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Queue_Adapter_AdapterAbstract
0025  */
0026 // require_once 'Zend/Queue/Adapter/AdapterAbstract.php';
0027 
0028 /**
0029  * Class testing.  No supported functions.  Also used to disable a Zend_Queue.
0030  *
0031  * @category   Zend
0032  * @package    Zend_Queue
0033  * @subpackage Adapter
0034  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0035  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0036  */
0037 class Zend_Queue_Adapter_Null extends Zend_Queue_Adapter_AdapterAbstract
0038 {
0039     /**
0040      * Constructor
0041      *
0042      * @param  array|Zend_Config $options
0043      * @param  null|Zend_Queue $queue
0044      * @return void
0045      */
0046     public function __construct($options, Zend_Queue $queue = null)
0047     {
0048         parent::__construct($options, $queue);
0049     }
0050 
0051     /********************************************************************
0052      * Queue management functions
0053      *********************************************************************/
0054 
0055     /**
0056      * Does a queue already exist?
0057      *
0058      * @throws Zend_Queue_Exception - not supported.
0059      */
0060     public function isExists($name)
0061     {
0062         // require_once 'Zend/Queue/Exception.php';
0063         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0064     }
0065 
0066 
0067     /**
0068      * Create a new queue
0069      *
0070      * @throws Zend_Queue_Exception - not supported.
0071      */
0072     public function create($name, $timeout=null)
0073     {
0074         // require_once 'Zend/Queue/Exception.php';
0075         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0076     }
0077 
0078     /**
0079      * Delete a queue and all of it's messages
0080      *
0081      * @throws Zend_Queue_Exception - not supported.
0082      */
0083     public function delete($name)
0084     {
0085         // require_once 'Zend/Queue/Exception.php';
0086         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0087     }
0088 
0089     /**
0090      * Get an array of all available queues
0091      *
0092      * @throws Zend_Queue_Exception - not supported.
0093      */
0094     public function getQueues()
0095     {
0096         // require_once 'Zend/Queue/Exception.php';
0097         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0098     }
0099 
0100     /**
0101      * Return the approximate number of messages in the queue
0102      *
0103      * @throws Zend_Queue_Exception - not supported.
0104      */
0105     public function count(Zend_Queue $queue=null)
0106     {
0107         // require_once 'Zend/Queue/Exception.php';
0108         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0109     }
0110 
0111     /********************************************************************
0112      * Messsage management functions
0113      *********************************************************************/
0114 
0115     /**
0116      * Send a message to the queue
0117      *
0118      * @throws Zend_Queue_Exception - not supported.
0119      */
0120     public function send($message, Zend_Queue $queue=null)
0121     {
0122         // require_once 'Zend/Queue/Exception.php';
0123         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0124     }
0125 
0126     /**
0127      * Get messages in the queue
0128      *
0129      * @throws Zend_Queue_Exception - not supported.
0130      */
0131     public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null)
0132     {
0133         // require_once 'Zend/Queue/Exception.php';
0134         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0135     }
0136 
0137     /**
0138      * Delete a message from the queue
0139      *
0140      * @throws Zend_Queue_Exception - not supported.
0141      */
0142     public function deleteMessage(Zend_Queue_Message $message)
0143     {
0144         // require_once 'Zend/Queue/Exception.php';
0145         throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this));
0146     }
0147 
0148     /********************************************************************
0149      * Supporting functions
0150      *********************************************************************/
0151 
0152     /**
0153      * Return a list of queue capabilities functions
0154      *
0155      * $array['function name'] = true or false
0156      * true is supported, false is not supported.
0157      *
0158      * @param  string $name
0159      * @return array
0160      */
0161     public function getCapabilities()
0162     {
0163         return array(
0164             'create'        => false,
0165             'delete'        => false,
0166             'send'          => false,
0167             'receive'       => false,
0168             'deleteMessage' => false,
0169             'getQueues'     => false,
0170             'count'         => false,
0171             'isExists'      => false,
0172         );
0173     }
0174 }