comparison vendor/zendframework/zend-stdlib/src/ArrayStack.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
4 *
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
9
10 namespace Zend\Stdlib;
11
12 use ArrayIterator;
13 use ArrayObject as PhpArrayObject;
14
15 /**
16 * ArrayObject that acts as a stack with regards to iteration
17 */
18 class ArrayStack extends PhpArrayObject
19 {
20 /**
21 * Retrieve iterator
22 *
23 * Retrieve an array copy of the object, reverse its order, and return an
24 * ArrayIterator with that reversed array.
25 *
26 * @return ArrayIterator
27 */
28 public function getIterator()
29 {
30 $array = $this->getArrayCopy();
31 return new ArrayIterator(array_reverse($array));
32 }
33 }