You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.8 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Pdf
  17. * @subpackage Actions
  18. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * Iteratable objects container
  24. *
  25. * @package Zend_Pdf
  26. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  27. * @license http://framework.zend.com/license/new-bsd New BSD License
  28. */
  29. class Zend_Pdf_RecursivelyIteratableObjectsContainer implements RecursiveIterator, Countable
  30. {
  31. protected $_objects = array();
  32. public function __construct(array $objects) { $this->_objects = $objects; }
  33. public function current() { return current($this->_objects); }
  34. public function key() { return key($this->_objects); }
  35. public function next() { return next($this->_objects); }
  36. public function rewind() { return reset($this->_objects); }
  37. public function valid() { return current($this->_objects) !== false; }
  38. public function getChildren() { return current($this->_objects); }
  39. public function hasChildren() { return count($this->_objects) > 0; }
  40. public function count() { return count($this->_objects); }
  41. }