web/lib/Zend/Cloud/QueueService/MessageSet.php
changeset 886 1e110b03ae96
parent 807 877f952ae2bd
child 1230 68c69c656a2c
equal deleted inserted replaced
885:2251fb41dbc7 886:1e110b03ae96
    11  * to license@zend.com so we can send you a copy immediately.
    11  * to license@zend.com so we can send you a copy immediately.
    12  *
    12  *
    13  * @category   Zend
    13  * @category   Zend
    14  * @package    Zend_Cloud
    14  * @package    Zend_Cloud
    15  * @subpackage QueueService
    15  * @subpackage QueueService
    16  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    16  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    17  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    18  */
    18  */
    19 
    19 
    20 /**
    20 /**
    21  * Collection of message objects
    21  * Collection of message objects
    22  *
    22  *
    23  * @category   Zend
    23  * @category   Zend
    24  * @package    Zend_Cloud
    24  * @package    Zend_Cloud
    25  * @subpackage QueueService
    25  * @subpackage QueueService
    26  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    26  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    27  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    27  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    28  */
    28  */
    29 class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate
    29 class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate
    30 {
    30 {
    31     /** @var int */
    31     /** @var int */
    34     /** @var ArrayAccess Messages */
    34     /** @var ArrayAccess Messages */
    35     protected $_messages;
    35     protected $_messages;
    36 
    36 
    37     /**
    37     /**
    38      * Constructor
    38      * Constructor
    39      * 
    39      *
    40      * @param  array $messages 
    40      * @param  array $messages
    41      * @return void
    41      * @return void
    42      */
    42      */
    43     public function __construct(array $messages)
    43     public function __construct(array $messages)
    44     {
    44     {
    45         $this->_messageCount = count($messages);
    45         $this->_messageCount = count($messages);
    46         $this->_messages     = new ArrayIterator($messages);
    46         $this->_messages     = new ArrayIterator($messages);
    47     }
    47     }
    48 
    48 
    49     /**
    49     /**
    50      * Countable: number of messages in collection
    50      * Countable: number of messages in collection
    51      * 
    51      *
    52      * @return int
    52      * @return int
    53      */
    53      */
    54     public function count()
    54     public function count()
    55     {
    55     {
    56         return $this->_messageCount;
    56         return $this->_messageCount;
    57     }
    57     }
    58 
    58 
    59     /**
    59     /**
    60      * IteratorAggregate: return iterable object
    60      * IteratorAggregate: return iterable object
    61      * 
    61      *
    62      * @return Traversable
    62      * @return Traversable
    63      */
    63      */
    64     public function getIterator()
    64     public function getIterator()
    65     {
    65     {
    66         return $this->_messages;
    66         return $this->_messages;