File indexing completed on 2024-05-12 06:02:54

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_Pdf
0017  * @subpackage Actions
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  * Iteratable objects container
0025  *
0026  * @package    Zend_Pdf
0027  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0028  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0029  */
0030 class Zend_Pdf_RecursivelyIteratableObjectsContainer implements RecursiveIterator, Countable
0031 {
0032     protected $_objects = array();
0033 
0034     public function __construct(array $objects) { $this->_objects = $objects; }
0035 
0036     public function current()      { return current($this->_objects);            }
0037     public function key()          { return key($this->_objects);                }
0038     public function next()         { return next($this->_objects);               }
0039     public function rewind()       { return reset($this->_objects);              }
0040     public function valid()        { return current($this->_objects) !== false;  }
0041     public function getChildren()  { return current($this->_objects);            }
0042     public function hasChildren()  { return count($this->_objects) > 0;          }
0043 
0044     public function count() { return count($this->_objects); }
0045 }