File indexing completed on 2025-03-02 05:29:13
0001 <?php 0002 /** 0003 * LICENSE 0004 * 0005 * This source file is subject to the new BSD license that is bundled 0006 * with this package in the file LICENSE.txt. 0007 * It is also available through the world-wide-web at this URL: 0008 * http://framework.zend.com/license/new-bsd 0009 * If you did not receive a copy of the license and are unable to 0010 * obtain it through the world-wide-web, please send an email 0011 * to license@zend.com so we can send you a copy immediately. 0012 * 0013 * @category Zend 0014 * @package Zend_Cloud 0015 * @subpackage QueueService 0016 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0017 * @license http://framework.zend.com/license/new-bsd New BSD License 0018 */ 0019 0020 /** 0021 * Collection of message objects 0022 * 0023 * @category Zend 0024 * @package Zend_Cloud 0025 * @subpackage QueueService 0026 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0027 * @license http://framework.zend.com/license/new-bsd New BSD License 0028 */ 0029 class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate 0030 { 0031 /** @var int */ 0032 protected $_messageCount; 0033 0034 /** @var ArrayAccess Messages */ 0035 protected $_messages; 0036 0037 /** 0038 * Constructor 0039 * 0040 * @param array $messages 0041 * @return void 0042 */ 0043 public function __construct(array $messages) 0044 { 0045 $this->_messageCount = count($messages); 0046 $this->_messages = new ArrayIterator($messages); 0047 } 0048 0049 /** 0050 * Countable: number of messages in collection 0051 * 0052 * @return int 0053 */ 0054 public function count() 0055 { 0056 return $this->_messageCount; 0057 } 0058 0059 /** 0060 * IteratorAggregate: return iterable object 0061 * 0062 * @return Traversable 0063 */ 0064 public function getIterator() 0065 { 0066 return $this->_messages; 0067 } 0068 }