File indexing completed on 2024-12-22 05:36:31

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 DocumentService
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  * Class encapsulating a set of documents
0022  *
0023  * @category   Zend
0024  * @package    Zend_Cloud
0025  * @subpackage DocumentService
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_DocumentService_DocumentSet implements Countable, IteratorAggregate
0030 {
0031     /** @var int */
0032     protected $_documentCount;
0033 
0034     /** @var ArrayIterator */
0035     protected $_documents;
0036 
0037     /**
0038      * Constructor
0039      *
0040      * @param  array $documents
0041      * @return void
0042      */
0043     public function __construct(array $documents)
0044     {
0045         $this->_documentCount = count($documents);
0046         $this->_documents     = new ArrayIterator($documents);
0047     }
0048 
0049     /**
0050      * Countable: number of documents in set
0051      *
0052      * @return int
0053      */
0054     public function count()
0055     {
0056         return $this->_documentCount;
0057     }
0058 
0059     /**
0060      * IteratorAggregate: retrieve iterator
0061      *
0062      * @return Traversable
0063      */
0064     public function getIterator()
0065     {
0066         return $this->_documents;
0067     }
0068 }